[TIP] Nose: marking a class with attrib doesn't skip the class (only the methods)

Dan Wandschneider daniel.wandschneider at schrodinger.com
Wed May 1 18:22:07 PDT 2013


All-
I'm using Nose to discover, run and report on our collection of unit tests,
all of which are written using python unittest classes and methods.  Many
of the tests have circumstances in which they should not be run, for
instance, if certain components fail to build, or on certain platforms.
 We've been decorating the tests using the attrib module to define these
limitations.  Sometimes I've decorated a class, other times a specific test
within the class.

I've noticed that if I decorate a class using attrib, Nose still runs
through the class, though it runs none of the test methods within it.  It
looks like attrib operates on methods and functions rather than classes.
 In particular, this means that setUpClass class methods are still run.
 Clearly, this is surprising, and it can actually cause problems in our
circumstances.

Is this expected/intended?  What is the rationale for not allowing classes
to be ignored, and instead ignored at the method level?

Thanks-
 Dan W.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20130501/bda48de7/attachment.htm>


More information about the testing-in-python mailing list