summaryrefslogtreecommitdiff
path: root/docs/topics/testing
diff options
context:
space:
mode:
authorTommy Beadle <tbeadle@arbor.net>2015-04-14 10:43:57 -0400
committerTim Graham <timograham@gmail.com>2015-08-24 08:59:20 -0400
commitd3fdaf907db6a5be4d0391532d7e65688c19e851 (patch)
treef29086e0f08340e6eed939c8f55ac97475f4aac1 /docs/topics/testing
parent45ed19de687d324d3ba852eea93b1afa575e482f (diff)
Fixed #23727 -- Inhibited the post_migrate signal when using serialized_rollback.
When using a TransactionTestCase with serialized_rollback=True, after creating the database and running its migrations (along with emitting the post_migrate signal), the contents of the database are serialized to _test_serialized_contents. After the first test case, _fixture_teardown() would flush the tables but then the post_migrate signal would be emitted and new rows (with new PKs) would be created in the django_content_type table. Then in any subsequent test cases in a suite, _fixture_setup() attempts to deserialize the content of _test_serialized_contents, but these rows are identical to the rows already in the database except for their PKs. This causes an IntegrityError due to the unique constraint in the django_content_type table. This change made it so that in the above scenario the post_migrate signal is not emitted after flushing the tables, since it will be repopulated during fixture_setup().
Diffstat (limited to 'docs/topics/testing')
-rw-r--r--docs/topics/testing/overview.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/topics/testing/overview.txt b/docs/topics/testing/overview.txt
index d345e9c36d..fc18eb0e4a 100644
--- a/docs/topics/testing/overview.txt
+++ b/docs/topics/testing/overview.txt
@@ -250,6 +250,13 @@ The initial serialization is usually very quick, but if you wish to exclude
some apps from this process (and speed up test runs slightly), you may add
those apps to :setting:`TEST_NON_SERIALIZED_APPS`.
+.. versionchanged:: 1.9
+
+To prevent serialized data from being loaded twice, setting
+``serialized_rollback=True`` disables the
+:data:`~django.db.models.signals.post_migrate` signal when flushing the test
+database.
+
Other test conditions
---------------------