Version 8 (modified by mrts, 7 years ago) (diff)


Running the test framework

When you submit a patch, you should always attach tests. Here are the guidelines for running the test framework to, ahem, test your tests.

Tests should be run with [source:django/trunk/tests/ django/trunk/tests/]

See also TestingDjango (I wasn't aware it existed before I started this).


To run tests, settings need to be provided.

Here's one possible way to do it using sqlite:

$ cd tests
$ ../django/bin/ startproject test_settings
$ sed -i "s/DATABASE_ENGINE = ''/DATABASE_ENGINE = 'sqlite3'/;s/DATABASE_NAME = ''/DATABASE_NAME = 'test.db'/" test_settings/
$ python --verbosity=2 --settings=test_settings.settings

Running only specific tests

This example runs only form tests:

$ python --verbosity=2 --settings=test_settings.settings forms

With cunning shell trickery, it's e.g. possible to only run admin tests:

./ --settings=test_settings.settings `(cd regressiontests/; echo admin_*; )`

Attachments (2)

Download all attachments as: .zip

Back to Top