[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 
http://svn.zope.org/zope.testing/branches/test-checkers/src/zope/testing/checkers.py?rev=72150&view=markup

This (test runners) seems to be one of those areas that is ripe for some 
cooperation/consolidation.
--
Benji York
http://benjiyork.com



More information about the testing-in-python mailing list