In this part we have a short look at the tool tdaemon and it’s application for testing Django.
Check out the other parts of this Testing Django series:
- Testing Django – part 1 – nose
- Testing Django – part 2 – lettuce
- Testing Django – part 3 – tdaemon
- Testing Django – part 4 – setting up a dedicated CouchDB for tests
Writing tests in one thing – running them frequently is another thing. The lazy coder uses an change induced, automated test runner for this – this is not yet proper continuous integration testing but a first, local step into that direction. A good option for Django (and Python in general) is tdaemon.
The installation is pretty simple. Download the tdaemon.py from github, make the file executable and put it in your ~/bin folder (alternative just put it the project folder and call it with it’s path).
Once you have set it up you can run it in your Django project folder in the following manner:.
$ tdaemon --test-program=django
Whenever a file is changed tdaemon will detect that and automatically run the tests for you. Isn’t that handy?