[TIP] Selectively running test packages with nose

Michael Foord fuzzyman at voidspace.org.uk
Tue Apr 6 16:32:41 PDT 2010

On 07/04/2010 00:26, Gary Bernhardt wrote:
> With an old version of nose (probably 0.10), I happily did things like
> "nosetests mypackage.tests.unit" for years, where "unit" was a
> package. With 0.11.3, this doesn't work; it finds no tests.
> I also tried "nosetests mypackage/tests/unit". It finds the tests,
> runs them, and then fails ("No module named mypackage"). This
> perplexes me.
> What are you guys using to segregate test suites nowadays? Clearly,
> I've missed something.

Hehe - well the next release of unittest2 (due tonight or tomorrow) will 
allow test discovery by dotted package name. The following should work:

unit2 discover mypackage.tests.unit

All the best,



READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.

More information about the testing-in-python mailing list