Hi,

Thanks for the suggestions.

2010/2/2 Phlip <phlip2...@gmail.com>

> Malcolm Box wrote:
>
> > Has anyone got any ideas on how to speed this up - for instance, is there
> a
> > way to say "use an existing test database"?
>
> Per my other advice to use fab and a fabfile with a test() target in
> it, you should set its (local()) target to something like
>
> OK, I need to have a look at fab to see what it can do for me.  I suspect
it won't solve the slow tests problem though - that seems to be a Django
issue.


> Do not use production fixtures for test fixtures, and if you must use
> the spew of dumpdata for fixtures you should manually trim them down
> to the minimum needed. Name them different from production fixtures.
> We have, naturally, a "countries.json", for all the regions we are
> allowed to sell to, and it takes forever to load. I pushed all our
> tests to use "sample_countries.json", instead, containing only
> countries that Sarah Palin could name on the spot. This made our tests
> much faster.
>
>
Nope, not using production data for fixtures.  Most of my fixtures contain a
handful of objects at most.


> And, finally, your test_settings.py file should use a sqlite3, in-
> memory database:
>
>
That would be wonderful, except my code doesn't run on sqlite3 as it relies
on some extra sql that sqlite doesn't support.


> From there, I have only been able to reduce test time down from hours
> to minutes. Tests ought to run in seconds - so fast that you can run
> them after every few edits - TDD.


Totally agree, and what I'm looking to make Django do.  At the moment a full
test run for my stuff takes about 5 minutes - not impossibly long, but long
enough for a task switch to something else.


> One
> of Django's particular sins is it drags all the data from your JSON
> fixtures into fully resolved models.py objects before saving them.
> This runs tons of Python code for no reason - you are not testing your
> models' validations or save routines. The test runner should instead
> push the JSON contents directly into the database as bulk import
> statements.
>
>
 Hmm, that sounds like something that could be fixed.  Does anyone know if
this is on the Django dev's radar and/or if someone's working on it?

Cheers,

Malcolm

-- 
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=en.

Reply via email to