[Twisted-Python] Several Trial test suites

Jonathan Lange jml at mumak.net
Tue Feb 12 17:40:41 EST 2008

On Feb 13, 2008 1:30 AM, Martin Geisler <mg at daimi.au.dk> wrote:
> Hello,
> I am using Twisted and Trial with great success for a project where we
> would like to have both a small regression test suite that should run
> quickly and a larger test suite which will test the system under more
> heavy load.
> My project lives in a package called viff, and so far I have created a
> viff.test package which contains the tests -- no problem, the test are
> picked up fine when I do 'trial viff'.
> To create a secondary test suite, do I have to create another package
> at the viff level, say viff.stress_test, or is there some clever way
> to organize things below viff.test?
> How to people organize such trees with many tests?
> Thanks for any inputs!

Hi Martin,

I'm not sure I understand your problem entirely, but I'll let you know
what I do.

My code lives in a package called 'foo'. Underneath that I have a
package called 'tests' that contains all my tests as 'test_*.py'
files. 'trial foo' runs all the tests.

If I wanted to have two different suites, say for unit tests and
integration tests, I might make another package beneath 'foo' called
'integrationtests'. If I felt a bit crazy that day, I might instead
move all of my unit tests to foo/tests/unit/ and all of my integration
tests to foo/tests/integration/.

The important things to remember are:
- Trial recurses down the Python module/package tree and treats
anything called 'test_*' as a possible location for tests.
- You can specify any fully-qualified Python name on the command line.
- There is no option to specifically exclude certain tests.
- You can define a test_suite() (or testSuite()) hook in a test module
if you want to do something fancy.


More information about the Twisted-Python mailing list