Version 2 (modified by Simon G. <dev@…>, 9 years ago) (diff)


Testing the django framework

(as opposed to testing your app).

If your app is having trouble, it is a good idea to run django's tests to make sure django is functioning properly. it also helps the developers catch bugs that could be system dependent, like OS, python version, db, etc.

To run the tests, you need to supply a very small settings file. you will probably want to write a small script to run tests and log the results. below is what I use.

DATABASE_ENGINE = 'sqlite3'   
DATABASE_NAME = 'demodb'
DATABASE_USER = 'foo'   
DATABASE_HOST = ''      

# runs the django tests, loggs the output

set -x

echo svnversion $(svnversion) > runtests.log

cat>> runtests.log
./ --settings settings_sqlite 2>&1|tee --append runtests.log

cat>> runtests.log
./ --settings settings_mysql 2>&1|tee --append runtests.log
rem runtests.bat --settings settings_sqlite 2>&1

note: most of the output is to stderr. the 2>&1 redirectes that to sdtout so that it can be redirected into a file, which is handy for posting when tests fail.

See also #4223

Back to Top