pytest.mark.order11

Here are the examples of the python api pytest.mark.order11 taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: python-arango Source File: test_cursor.py
@pytest.mark.order11
def test_cursor_context_manager():
    global cursor, cursor_id

    col.truncate()
    col.import_bulk([doc1, doc2, doc3])

    with db.aql.execute(
        'FOR d IN {} RETURN d'.format(col_name),
        count=False,
        batch_size=2,
        ttl=1000,
        optimizer_rules=['+all']
    ) as cursor:
        assert clean_keys(cursor.next()) == doc1
    with pytest.raises(CursorCloseError):
        cursor.close(ignore_missing=False)

    with db.aql.execute(
        'FOR d IN {} RETURN d'.format(col_name),
        count=False,
        batch_size=2,
        ttl=1000,
        optimizer_rules=['+all']
    ) as cursor:
        assert clean_keys(cursor.__next__()) == doc1
    with pytest.raises(CursorCloseError):
        cursor.close(ignore_missing=False)
    assert cursor.close(ignore_missing=True) is False

Example 2

Project: python-arango Source File: test_graph.py
Function: test_get_vertex
@pytest.mark.order11
def test_get_vertex():
    vcol = graph.vertex_collection('vcol1')

    # Test get missing vertex
    assert vcol.get('0') is None

    # Test get existing vertex
    result = vcol.get('1')
    old_rev = result['_rev']
    assert clean_keys(result) == {'_key': '1', 'value': 1}

    # Test get existing vertex with wrong revision
    with pytest.raises(ArangoError):
        vcol.get('1', rev=old_rev + '1')

    # Test get existing vertex from missing vertex collection
    with pytest.raises(DocuementGetError):
        bad_vcol.get('1')

    # Test get existing vertex again
    assert clean_keys(vcol.get('2')) == {'_key': '2', 'value': 2}