So a few things we've done to take our test suite from 45 minutes to
12:

1. Implement global fixtures

These get loaded after syncing just like initial data. Obviously this
is a massive speed up
as you only reload them in between transaction test cases.

2. Don't inherit from TestCase if you aren't using the db

Around 10% of our tests now inherit from unit test instead. This
let's us only bootstrap the db if it's required as well as skip
any db flushing on those tests.

3. Speedup fixture loading

More or less what is proposed by the original poster

4. Stop writing integration tests

Biggest win :) learn to use mock


On Jan 19, 12:47 pm, Adrian Holovaty <adr...@holovaty.com> wrote:
> On Mon, Jan 16, 2012 at 10:46 AM, Anssi Kääriäinen
>
> <anssi.kaariai...@thl.fi> wrote:
> > I have been investigating what takes time in Django's test runner and
> > if there is anything to do about it. The short answer is: yes, there
> > is a lot of room for improvement. I managed to reduce the running
> > speed of the test suite (on sqlite3) from 1700 seconds to around 500
> > seconds. On postgresql I reduced the run time from 5000 to 2500
> > seconds.
>
> Wow! Just wanted to say thanks for doing all of this work and making
> these optimizations. I'm going to take a look at #16759, along with
> your Git branch.
>
> Adrian

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

Reply via email to