[TIP] Unittest framework with good process isolation
robertc at robertcollins.net
Fri Aug 3 14:53:36 PDT 2012
On Sat, Aug 4, 2012 at 9:31 AM, Jonathan Hunt <hunt at braincorporation.com> wrote:
> We have written our tests using the built-in python unittest framework and
> we currently use nosetest to collect, run and report the tests.
> Things we like about nose:
> uses standard python unit tests (we like the structure this imposes).
> supports reporting coverage and test output in xml (for jenkins).
> What we are missing is a good way to run tests in isolated processes while
> maintaining good error repoorting (we are testing C++ libraries through
> python so segfaults should not be catastrophic and each unittest is designed
> to run in isolation). nosepipe seems to be no longer maintained and we have
> some problems with it.
> We are trying to figure out whether we should - fix/use nosepipe - switch to
> nose2 and write nosepipe2. - use pytest or some other testing framework.
> We would prefer to use an approach with a good community. It seems our
> problem (C++ plugins requiring good isolation) might be a common problem but
> googling I have not found solutions that are maintained. Advice from more
> experienced heads appreciated.
This was one of the design criteria for subunit. You can wrap a single
unittest test suite in another process using IsolatedTestSuite (and
you can use one of those per test if you need each test case to be
isolated). If you are executing C++ unittests, there is a subunit
report for CPPUnit, so you can execute native CPPUnit tests and report
on them from Python.
Subunit is compatible with the unittest protocol, so you can use it
and its components in any unittest compatible runner (such as trial,
More information about the testing-in-python