views:

37

answers:

2

Running Django unit tests is far too slow. Especially when I just want to run one test but the test runner wants to create the entire database and destroy the whole thing just for that one test.

In the case where I have not changed any of my models, I could save oodles of time if Django would not bother trying to create and destroy the entire database, and instead saved it for next time. Better yet, it would be great if the test runner was capable of being able to see which models have changed and only replacing those prior to running tests.

I'd prefer to not have to subclass the test runner myself, but that's what I'm going to have to do if I don't find a solution soon. is there anything like this already in existence?

+2  A: 

Have you tried using an in-memory SQLite database for tests? It's much faster than using a disk-based database.

Ned Batchelder
Last time I tried, spatialite wasn't playing nicely on whatever version of ubuntu I was using, so I quickly abandoned that. I should try it again now though.
Conley Owens
I think it is necessary to run the tests on the same database, as you use in live, if not always, atleast before every commit.
Lakshman Prasad
+2  A: 

django-test-utils provides Persistent Database Test Runner functionality, http://ericholscher.com/projects/django-test-utils/keep_database_runner.html

Ashok