[TIP] Supporting multiple fixtures for a test suite

Gary Bernhardt gary.bernhardt at gmail.com
Fri Jan 4 10:45:27 PST 2008


On Jan 4, 2008 1:07 PM, Kumar McMillan <kumar.mcmillan at gmail.com> wrote:
> from common_tests import *
>
> ... doesn't that do what you mean?

For a single module, yes.  But the functional tests live in a package
with many test modules.  Doing "from x import *" doesn't bring in
child modules when x is a package.

In the package's __init__.py, I could do "from x import y" for each
functional test module y, but that confuses nose.  When I do
"nosetests tests.system3.test_bbclient" (a single test module), it
finds the named test; if I do "nosetests tests.system3" (the root of
the cloned test package), it doesn't find anything.  I have no idea
why this happens.  (Also note that this is all happening in a heavily
hacked sandbox; I wouldn't commit a test package named "system3" ;)

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. :)

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



More information about the testing-in-python mailing list