On Tuesday 02 September 2014 15:27:53 Josh Smeaton wrote:
> 
> As far as I'm concerned, using fixtures is the wrong way to populate data
> for tests. You're much better off creating the objects you need for each
> test within the test, or creating them directly inside the setUp method.

+1.

> You avoid the parsing and loading of json data, which is quite substantial!

This I find a rather weak argument. The main reason to create test-objects in 
code rather than fixtures is that models evolve (especially when thinking about 
Django>=1.7), and fixtures are pretty close to impossible to adapt. I've been 
involved in efforts to do the automatic adaptations (essentially, start with an 
empty DB and code at the commit before the change; load the fixture, update 
sources, migrate, and dump the new fixture). There are significant problems 
with 
this approach (e.g. if the code that does this sits in the same repo as the 
project code, then fixes to some parts of it need to be added with a time 
machine).

HTH,
        Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1706948.qZmFATPrIL%40deblack.
For more options, visit https://groups.google.com/d/optout.

Reply via email to