[TIP] Test discovery for unittest

Marius Gedminas marius at gedmin.as
Tue Apr 7 08:10:59 PDT 2009


On Wed, Apr 08, 2009 at 12:03:24AM +1000, Robert Collins wrote:
> On Tue, 2009-04-07 at 16:48 +0300, Marius Gedminas wrote:
> > There is a desire in the Zope 3 world to migrate away from our own
> > test runner to something more standard (probably nose), but nobody
> > has the time to work on that (and we have features---such as test
> > layers with a single expensive setUp/tearDown function pair wrapping
> > multiple tests, with the tests grouped into layers according to the
> > 'layer' attribute of the individual testcases/suites coming from
> > various locations in the tree---that AFAIK nose doesn't have).
> 
> You might like testresources; it was written for ~ the same use case as
> layers, but it is unittest compatible. [stock unittest can run things
> using testresources, and they work].

testresources is a name I hadn't heard before, and I'll certainly
investigate at it.  However, looking at the various solutions out there
requires time that the Zope people usually don't have...

One of the things Zope relies on is that layer tearDown can raise
NotImplementedError, in which case the test runner will for and run the
next layer's tests in a fresh process.  (Yes, Zope uses rather more of
global state than is healthy, or at least used to, and is now too
conservative to just assume layer tearDown can clean everything up.)
This is esoteric enough that I don't expect to find it anywhere else
(well, maybe subunit ;), without adding that those layers can stack.

Marius Gedminas
-- 
An algorithm must be seen to be believed.
                -- D.E. Knuth
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090407/90a17cd5/attachment.pgp 


More information about the testing-in-python mailing list