[TIP] Testify

Robert Collins robertc at robertcollins.net
Sat Oct 30 19:15:42 PDT 2010


On Sun, Oct 31, 2010 at 2:20 AM, Marius Gedminas <marius at gedmin.as> wrote:
> There's also zope.testrunner, which suffers from the Zope stigma, so
> almost nobody uses it outside Zope-related projects.  It has one unique
> feature you may find interesting: test layers, which provide a way to
> have shared setup/teardown that is not tied to package/module/class
> hierarchy.

Hardly unique; testresources, which I wrote at about the same time as
layers were added is approximately equivalent to layers, doesn't need
a custom runner, and works with unittest2/testools - I'd expect it to
work with nose, but I haven't actually tried.


> But it would be nice to be able to switch test _runners_ and get all
> those nice features (different output formats, colorization,
> parallelization, test selection) for your existing test suites, no
> matter which framework these used.

I'd like to make all runners be the same five lines:
result.startTestRun()
try:
    suite.run(result)
finally:
    result.stopTestRun()

The real interesting stuff is in creating suite (for parallelisation)
and result (for colourisations, xml output, streaming to another
server etc).

-Rob



More information about the testing-in-python mailing list