#23727: IntegrityError with TransactionTestCase and serialized_rollback=True
-----------------------------------+------------------------------------
Reporter: tctimmeh | Owner: tbeadle
Type: Bug | Status: closed
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"d3fdaf907db6a5be4d0391532d7e65688c19e851" d3fdaf90]:
{{{
#!CommitTicketReference repository=""
revision="d3fdaf907db6a5be4d0391532d7e65688c19e851"
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().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23727#comment:12>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.ef352de7c38a5d23e7470652b3534e12%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.