The answer:

While all tests should use the transaction-rollback trick, and it
seems the sqlite3 handlers don't use it...

...the primary culprit turned out to be this:

  fixtures = ['countries']

Even though the tests run in an app with a fixture with a very short
list of sample countries & regions...

...another app, higher up the food chain, has a "fixture" that
contains all the database prep, with all the countries, designed to be
loaded only once.

The fix is of course renaming the shorter json file:

  fixtures = ['short_countries']

This problem represents two minor oversights in Django's architecture:

Firstly, the original meaning of a "fixture" was _behavior_ shared by
test cases. assertEqual() was a fixture, as was assertInvoiceGotMailed
(). The first is generic and the second application-specific. Ruby on
Rails stretched this definition by referring to the model objects
available to tests as fixtures - that was a mistake. Database objects
were supposed to be called "resources", in the original Smalltalk
mileux. Enough said, and nobody's making a Federal case out of it.

Nextly, the lookup for fixtures=[] should start in the current app.
Django intends to be testable and modular, but your tests should not
all break just because you suddenly plugged in a new module that came
with a fixture that preempted your fixture.

> --
>  Phlip
>  http://c2.com/cgi/wiki?ZeekLand

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.


Reply via email to