summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/test/testcases.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/django/test/testcases.py b/django/test/testcases.py
index 93ad8b9354..c4ee8984a9 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -940,10 +940,19 @@ class TransactionTestCase(SimpleTestCase):
# when flushing only a subset of the apps
for db_name in self._databases_names(include_mirrors=False):
# Flush the database
+ inhibit_post_migrate = (
+ self.available_apps is not None
+ or (
+ # Inhibit the post_migrate signal when using serialized
+ # rollback to avoid trying to recreate the serialized data.
+ self.serialized_rollback and
+ hasattr(connections[db_name], '_test_serialized_contents')
+ )
+ )
call_command('flush', verbosity=0, interactive=False,
database=db_name, reset_sequences=False,
allow_cascade=self.available_apps is not None,
- inhibit_post_migrate=self.available_apps is not None)
+ inhibit_post_migrate=inhibit_post_migrate)
def assertQuerysetEqual(self, qs, values, transform=repr, ordered=True, msg=None):
items = six.moves.map(transform, qs)