pytest.mark.order9

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

5 Examples 7

Example 1

Project: python-arango Source File: test_database.py
Function: test_create_graph
@pytest.mark.order9
def test_create_graph():
    # Test create duplicate graph
    with pytest.raises(GraphCreateError):
        db.create_graph(graph_name)

    new_graph_name = generate_graph_name(db)
    db.create_graph(new_graph_name)
    assert new_graph_name in [g['name'] for g in db.graphs()]

Example 2

Project: python-arango Source File: test_graph.py
@pytest.mark.order9
def test_create_graph_with_vertices_ane_edges():
    new_graph_name = generate_graph_name(db)
    edge_definitions = [
        {
            'name': 'ecol1',
            'from_collections': ['vcol3'],
            'to_collections': ['vcol2']
        }
    ]
    new_graph = db.create_graph(
        new_graph_name,
        edge_definitions=edge_definitions,
        orphan_collections=['vcol1']
    )
    assert new_graph.edge_definitions() == edge_definitions
    assert new_graph.orphan_collections() == ['vcol1']

Example 3

Project: python-arango Source File: test_aql.py
@pytest.mark.order9
def test_clear_query_cache():
    result = db.aql.cache.clear()
    assert isinstance(result, bool)

Example 4

Project: python-arango Source File: test_async.py
@pytest.mark.order9
def test_clear_async_jobs():
    # Set up test docuements
    async = db.async(return_result=True)
    job1 = async.collection(col_name).insert({'_key': '1', 'val': 1})
    job2 = async.collection(col_name).insert({'_key': '2', 'val': 2})
    job3 = async.collection(col_name).insert({'_key': '3', 'val': 3})
    for job in [job1, job2, job3]:
        wait_on_job(job)
        assert job.status() == 'done'

    # Test clear all async jobs
    assert arango_client.clear_async_jobs() is True
    for job in [job1, job2, job3]:
        with pytest.raises(AsyncJobStatusError) as err:
            job.status()
        assert 'Job {} missing'.format(job.id) in err.value.message

    # Set up test docuements again
    async = db.async(return_result=True)
    job1 = async.collection(col_name).insert({'_key': '1', 'val': 1})
    job2 = async.collection(col_name).insert({'_key': '2', 'val': 2})
    job3 = async.collection(col_name).insert({'_key': '3', 'val': 3})
    for job in [job1, job2, job3]:
        wait_on_job(job)
        assert job.status() == 'done'

    # Test clear jobs that have not expired yet
    past = int(time()) - 1000000
    assert arango_client.clear_async_jobs(threshold=past) is True
    for job in [job1, job2, job3]:
        assert job.status() == 'done'

    future = int(time()) + 1000000
    assert arango_client.clear_async_jobs(threshold=future) is True
    for job in [job1, job2, job3]:
        with pytest.raises(AsyncJobStatusError) as err:
            job.status()
        assert 'Job {} missing'.format(job.id) in err.value.message

    # Test clear job without authentication
    with pytest.raises(AsyncJobClearError) as err:
        ArangoClient(password='incorrect').clear_async_jobs()
    assert 'HTTP 401' in err.value.message

Example 5

Project: python-arango Source File: test_cursor.py
@pytest.mark.order9
def test_write_cursor_second():
    clean_keys(cursor.next()) == doc2
    assert cursor.id is None
    assert cursor.has_more() is False
    assert cursor.cached() is False
    assert cursor.statistics()['modified'] == 2
    assert cursor.statistics()['filtered'] == 0
    assert cursor.statistics()['ignored'] == 0
    assert cursor.statistics()['scanned_full'] == 0
    assert cursor.statistics()['scanned_index'] == 2
    assert cursor.warnings() == []
    assert cursor.count() == 2
    assert clean_keys(cursor.batch()) == []
    assert isinstance(cursor.statistics()['execution_time'], float)
    with pytest.raises(StopIteration):
        cursor.next()
    assert cursor.close(ignore_missing=True) is False

    incorrect_cursor_data = {'id': 'invalid', 'hasMore': True, 'result': []}
    setattr(cursor, '_data', incorrect_cursor_data)
    with pytest.raises(CursorCloseError):
        cursor.close(ignore_missing=False)
    with pytest.raises(CursorNextError):
        cursor.next()