#11665: django.test.TestCase should flush constraints
----------------------------------------+-----------------------------------
          Reporter:  Glenn              |         Owner:  nobody
            Status:  new                |     Milestone:  1.2   
         Component:  Testing framework  |       Version:  SVN   
        Resolution:                     |      Keywords:        
             Stage:  Accepted           |     Has_patch:  0     
        Needs_docs:  0                  |   Needs_tests:  0     
Needs_better_patch:  0                  |  
----------------------------------------+-----------------------------------
Comment (by russellm):

 @pcardune: The patch will become available about 30 seconds after somebody
 writes it.

 The solution here isn't to change the constraint definition. Constraints
 need to be DEFERRABLE, not IMMEDIATE - there are a number of tests that
 fail if constraint checks aren't deferred. To see which ones, run the test
 suite using MySQL with InnoDB. InnoDB only has IMMEDIATE mode for
 transactions, and fails a lot of tests as a result.

 The interim workaround - if you actually need transactions, use
 TransactionTestCase rather than TestCase. This is slower, but uses a
 database truncate rather than transaction rollback to flush the database.

 I don't know what the final solution will be, but I suspect it will
 involve reliable cleanup of the transaction on rollback, rather than
 changing the database so that the triggers aren't hit.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11665#comment:4>
Django <http://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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to