[TIP] getting access to the discovered test list

Benji York benji at benjiyork.com
Thu Mar 1 07:32:24 PST 2007

Kumar McMillan wrote:
> On 2/28/07, bear <bear42 at gmail.com> wrote:
>> What we are doing is giving the developer the normal "run all unit tests"
>> option which runs them all using the same python instance that was used to
>> start nose.  But a request was made to also be able to gather the list of
>> tests and then start each test in its own python - that way any errant code
>> won't pollute the environment for downstream tests.
>> So what I have done is run the loader code to build a list of TestCase
>> instances and then cycle thru that list calling "python run_test <insert
>> name of test here>"

The test runner included in zope.testing (that like so many things 
nowadays isn't tied to Zope 2 or 3, just think of "zope." as a 
namespace) has the concept of test layers, which can be constructed such 
that they each run in a subprocess.

> - Focus more on your teardown code.  Clear caches, delete registries,
> remove the entire database, get aggressive with it.

There is a feature branch in development right now of zope.testing that 
lets you specify "checkers" that are essentially tests that can be run 
on your tests.  One of the major use cases is finding incomplete 
tear-down code.  You might get some inspiration from that.  Pertinent 
code at 

This (test runners) seems to be one of those areas that is ripe for some 
Benji York

More information about the testing-in-python mailing list