Skip to content

Commit

Permalink
Extra-step in empty database fixture to ensure proper teardown.
Browse files Browse the repository at this point in the history
  • Loading branch information
timstaley committed Jan 3, 2016
1 parent 2d5a793 commit 462181b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions voeventdb/server/tests/fixtures/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def empty_db_connection(request):
yield connection
# TearDown
transaction.rollback()
# The next line is effectively voodoo; it shouldn't be necessary but seems
# to fix some intermittent race-condition issue which occasionally causes
# py.test runs to fail due to database-integrity errors.
# (My guess is that the transaction-rollback is somehow entering a
# race-condition with the next test, adding this extra command ensures that
# the database is properly emptied before continuing.)
Base.metadata.drop_all(bind=connection)
connection.close()
engine.dispose()

Expand Down

0 comments on commit 462181b

Please sign in to comment.