def db_reload(datadir): for table in reversed(tables.metadata.sorted_tables): print('Deleting {}'.format(table)) db.session.execute(table.delete()) print('Loading database from {}'.format(datadir)) load_from_directory(db.session, datadir) print('Database loaded')
def test_load_twice(db, data_directory): with pytest.raises((ValueError, IntegrityError)): load_from_directory(db, data_directory)