#22487: Moving from initial_data to data migrations stops test data persisting
-------------------------------------+-------------------------------------
     Reporter:  andrewgodwin         |                    Owner:
         Type:  Bug                  |  andrewgodwin
    Component:  Testing framework    |                   Status:  closed
     Severity:  Release blocker      |                  Version:
     Keywords:                       |  1.7-beta-1
    Has patch:  0                    |               Resolution:  fixed
  Needs tests:  0                    |             Triage Stage:  Accepted
Easy pickings:  0                    |      Needs documentation:  0
                                     |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by RafalP):

 Andrew,

 Indeed I have custom User model with relations to other models.

 I've did {{{dumpdata}}} to file, then ran {{{flush}}} and finally ran
 {{{loaddata}}} for file I've created ealier, and Django raised no errors.

 To sum this up, if my test case is {{{TransactionTestCase}}} with
 {{{serialized_rollback = True}}}, test case fails on {{{IntegrityError}}}.
 This test case is dependant on data created in data migration, so when I
 make it inherit from {{{TestCase}}} instead, it fails because database
 tables are emptied before tests are ran. I am running my tests against
 PostgreSQL 9.3 database and I have no idea why this happens, because I was
 under impression that flushes should happen only on DB's that can't use
 transactions to reverse db changes made by tests?

 Again, thanks for your time and energy!

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22487#comment:24>
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/070.71be91d58c6baedc65dea3bf0a0ab796%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to