How to organize test cases with PyUnit
Syver Enstad
syver-en+usenet at online.no
Sun Jul 21 13:36:49 EDT 2002
donnal at donnal.net (Donnal Walter) writes:
<snipped>
>
> Yes, from the responses here that does appear to be the conventional
> way of doing things, so I guess I will continue using unittest this
> way too. I had thought I might replace my batch files with a
> TestSuite, but I'm really not complaining about the way it works now.
> Thanks.
Btw, here's some code I put in my __init__.py files to run unittest
for all modules in a package. Maybe it does some of the things your
are looking for?
moduleNames = map(lambda each: os.path.splitext(each)[0],
filter(lambda each: each != '__init__.py',
glob.glob('*.py')))
# this was the testLoader I was talking about, it makes a suite from
all TestCase derived classes in moduleNames.
suite = unittest.defaultTestLoader.loadTestsFromNames(moduleNames)
runner = unittest.TextTestRunner(verbosity=1)
runner.run(suite)
--
Vennlig hilsen
Syver Enstad
More information about the Python-list
mailing list