|Version 2 (modified by Simon G. <dev@…>, 8 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.
# settings_sqlite.py DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = 'demodb' ROOT_URLCONF=None SITE_ID=1
# settings_mysql.py DATABASE_ENGINE = 'mysql' DATABASE_USER = 'foo' DATABASE_PASSWORD = 'abc' DATABASE_HOST = '' DATABASE_PORT = '' ROOT_URLCONF=None SITE_ID=1 TEST_DATABASE_CHARSET = 'utf8'
# runtests.sh # runs the django tests, loggs the output set -x echo svnversion $(svnversion) > runtests.log cat settings_sqlite.py>> runtests.log ./runtests.py --settings settings_sqlite 2>&1|tee --append runtests.log cat settings_mysql.py>> runtests.log ./runtests.py --settings settings_mysql 2>&1|tee --append runtests.log
rem runtests.bat runtests.py --settings settings_sqlite 2>&1
note: most of the runtests.py 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