enewe101 / digidemo

digital democracy engine
1 stars 0 forks source link

Faster tests #65

Closed enewe101 closed 9 years ago

enewe101 commented 9 years ago

Especially since updating to Django 1.7, tests have become very slow. I'm introducing a new dependency into the project that will help us with this problem: django-nose.

At your next convenience, do:

`pip install django-nose`

Then, once you pull from master, you can run tests quickly using this command:

./test.py

If you want to run specific tests, you need to use this syntax:

./test.py digidemo.test:NameOfTestCase.name_of_test_method

Note the use of the colon ':' which is different from the previous syntax.

The speedup comes from the fact that the test database is preserved between test runs, rather than being rebuilt and destroyed every time. But this means that, after changing the changing the database (by adding data, or because of a schema change during a migration), you need to use this syntax to force the test database to be rebuilt. You only have to run like this once after such a change:

./test.py --rebuild [optionally followed by a TestCase designation]

(I haven't merged this into master yet but I will shortly)

enewe101 commented 9 years ago

BTW, the test database is built automatically the very first time you run it, so you'll only see the speedup the next time you run tests!

enewe101 commented 9 years ago

Merged into master.