Quick spec from your Python tests

Date Arrow  April 17, 2008

Using Python’s own unittest package, here’s a small script that can iterate over your test suite to output a small, quick, nice list of the tests in your application:

This would yield something like this:

Business
    Accounts have at least one entry
    Clerks cannot close accounts
Security
    Users can create new accounts
    Anonymous users cannot access private areas
...

Of course, you’ll get better results if you follow Google’s naming conventions for your tests… ;) This is not rspec (nor an alternative to it) but it might be useful to some of you.

Just as a reminder for Django users: you might need to


setenv DJANGO_SETTINGS_MODULE application.settings

or


export DJANGO_SETTINGS_MODULE=application.settings

in order to make the script work properly! At least I had to :)

Similar Posts:

Tagged   Django · How to? · Quality

2 Comments

Commenting