I'm in the middle of trying to track down a problem with loading fixtures 
during unit tests -- I'm hesitant to call it a bug in Django 1.7, but the 
inconsistent behavior is really stumping me.

Essentially I've made a fixture via

   manage dumpdata --indent=3 -e sessions -e admin -e contenttypes -e 
auth.Permission > test-fixtures.json

If I add that fixtures to my TestCase, it sometimes works if I run each 
test individually (using Django Nose)  -- 

   manage test --failfast test_it:TestClass.test_detail
   manage test --failfast test_it:TestClass.test_list

But if I run them together, 

   manage test --failfast test_it:TestClass

I get errors about duplicate/unique problems.  Essentially a row is 
attempted to be added twice. 

    IntegrityError: Problem installing fixture 'test-fixtures.json': Could 
not load app.Branch(pk=1): duplicate key value violates unique constraint 
"app_branch_name_49810fc21046d2e2_uniq"
DETAIL:  Key (name)=(mock) already exists.

(I've also posted this earlier today on django-users, where I also included 
some postgres output).  The tests within the TestCase (or 
TransactionTestCase) can be empty ("pass") and still reproduce.

As best I can tell it doesn't only happen when combined -- sometimes I can 
get it to happen in a class with a single TestCase.  And it isn't always 
the same model that has the conflict.

Has anyone seen anything like this behavior before?  It's as if sometimes 
the fixtures are installed in different order each time, which makes me 
think of some dict.keys() that doesn't return the same order every time.

Rich



-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/37075277-2390-476c-9d32-3b3e594d2e4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to