Ejemplo n.º 1
0
def test_init():
    # try open not existing database
    with pytest.raises(sqlite3.OperationalError):
        Database("file_does_not_exist.database", table_prefix="ae")

    # open existing database
    database = Database(PRIDB_FILE_PATH, table_prefix="ae")
    assert database.connected
    database.close()
    assert not database.connected
    database.close()  # double close should not cause an exception

    # require file extension
    with pytest.raises(ValueError):
        Database(PRIDB_FILE_PATH,
                 table_prefix="ae",
                 required_file_ext=".nonsense")
Ejemplo n.º 2
0
def fixture_sample_tradb():
    database = Database(TRADB_FILE_PATH, table_prefix="tr")
    yield database
    database.close()
Ejemplo n.º 3
0
def fixture_sample_pridb():
    database = Database(PRIDB_FILE_PATH, table_prefix="ae")
    yield database
    database.close()