Friday, January 7, 2011

Running doctests in a django project.

Running doctests from a specific file (or files in a directory) could be painful in the django environment (specially with older versions of django).
Just uploaded a script as gist on github, which can help. This script lets you run all doctests from a given file or files in a directory. One would run this from the base directory of your site (i.e., the same directory with manage.py in it).
Note that
manage.py test xxx 
will let you run tests for your django application but will search for docstrings in
app/tests.py and models.py 
(at least of pre django 1.0). If you have a large project its unlikely that you would have such monolithic files.

No comments:

Post a Comment