unittest: Dynamically creating tests

Jeremy Bowers jerf at jerf.org
Wed Jun 11 23:15:12 CEST 2003


On Wed, 11 Jun 2003 06:41:40 +0000, Raymond Hettinger wrote:
> Don't use main() which expects to parse your file for class names.
> Instead, substitute this line:
> 
>     unittest.TextTestRunner().run(tests)

Thanks, this is working for me.

As a side-note, don't give your TestCases attribute names starting with
"test", like "testName". ;-) The unittest framework thinks those are
tests.

The tests are now merrily blowing up as expected; TDD can sometimes be
depressing initially ;-)




More information about the Python-list mailing list