[Twisted-Python] Trial: testing multiple test modules in one go?

Paul Goins general at vultaire.net
Wed Nov 4 20:50:05 EST 2009


My project has 160 or so test functions spread across 29 test modules.
The layout is something like this:

project_root/
  <project>/
    <module>.py
    <module>.py
    ...
  tests/
    <test_module>.py
    <test_module>.py
    ...
    unit_tests.py

Running tests one-by-one ("trial tests.<test_module>") works perfectly.
 However, I want to test them all in one go, and can't find a "proper"
way to do it.

Currently to test it, I have a module, tests.unit_tests, which imports
all the tests from all other modules in the tests namespace via:

  from tests.<test_module_1> import *
  from tests.<test_module_2> import *
  ...

However, this is less than ideal, since if someone makes a unit test
class with the same name as one in another module, they overlap and one
ends up untested.  (We just got blindsided by this to some degree, hence
the e-mail.)

I'll probably end up just attaching the test module's name as a prefix
to each test class, but I wanted to ask, is there a better, "proper" way
of doing this?

Thanks.

- Paul Goins




More information about the Twisted-Python mailing list