[TIP] Supporting multiple fixtures for a test suite

Gary Bernhardt gary.bernhardt at gmail.com
Sun Jan 6 12:29:16 PST 2008


On Jan 4, 2008 1:45 PM, Gary Bernhardt <gary.bernhardt at gmail.com> wrote:
> Even when I get nose to actually find the tests, they don't run
> successfully.  I'm seeing the module-level setup/teardown functions
> called multiple times successively, which makes them explode
> violently.  I'm sure I can work that out eventually, but that's as far
> as I've gotten.  I've run into similar problems before; It seems that
> nose doesn't respond well whenever you start importing whole test
> modules.  Or maybe I'm doing something wrong. :)

For the benefit of the archives:

This was caused by a bug in nose.  When a test class is imported from
another package, it remembers where it was defined.  This confuses
nose, causing it to run fixtures from the definition package *and* the
importing package.  The error I'm talking about in the quoted text
above happened when both packages had the same setup and teardown
functions, so the net result was duplicate calls to them.  This bug
only seems to affect test classes, not test functions.  More info is
at the ticket on Google Code:
http://code.google.com/p/python-nose/issues/detail?id=145

-- 
Gary
http://blog.extracheese.org



More information about the testing-in-python mailing list