Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rolled back managed transactions before flushing fixtures.

  • Loading branch information...
commit 4dbfdc677c6c922f3797be83f67d1a26ab68d221 1 parent 319e135
Jeremy Dunck authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 django/test/testcases.py
View
8 django/test/testcases.py
@@ -557,6 +557,14 @@ def _fixture_teardown(self):
# If the test case has a multi_db=True flag, flush all databases.
# Otherwise, just flush default.
databases = connections if getattr(self, 'multi_db', False) else [DEFAULT_DB_ALIAS]
+
+ # roll back any pending transactions so that we release locks
+ # for the flushes we're about to do.
+ # (otherwise 2 aliases pointing to the same DB could block each other).
+ # see 18984
+ for db in databases:
+ databases[db].rollback_unless_managed()
+
for db in databases:
call_command('flush', verbosity=0, interactive=False, database=db,
skip_validation=True, reset_sequences=False)
Please sign in to comment.
Something went wrong with that request. Please try again.