How do you do unittest?

Will Stuyvesant hwlgw at
Sat Aug 2 09:18:58 CEST 2003

> [Raymond Hettinger]
> You can avoid that sort of mambo jambo by avoiding
> unittest.main() and running the tests directly.  I added
> a simple example to the Py2.3 docs:

Thanks, I now use unittest.TextTestRunner (what a name!) in in a test_mod.test function.  Together with a general in the 'test' directory that does the sys.path.append('..') I
can now run tests in the test directory so I don't have all the
clutter in the source directory, and I don't have to do
sys.path.append('..') in every, only in the that
looks like:

# To be executed in the 'test' directory
import sys
import test_mod
import test_mod2

More information about the Python-list mailing list