nose-devs/nose — pull request #721 by jiffyclub (2013-08-05 06:54:50+00:00)
Title: BUG: Don't pull methods from TestCase superclasses

`TestLoader` overrides the `TestCase.getTestCaseNames` so that nose's own filtering can intercede (especially things like attribute filtering). Once a class' methods have been filtered, `getTestCaseNames` then goes through all of the class' bases and loads any tests from those classes too.

The problem with this is that the superclass filtering is done in the context of the superclass, without knowledge of any attributes that may be set on actual test for which collection is being performed. If an attribute is set on the test for which collection is being performed that should completely turn off any tests in that class, the collection will actually grab tests from superclasses and cause them to be run. This is extremely annoying when those tests are slow and cumbersome.

See this post on nose-users as an example of what happens: https://groups.google.com/forum/#!msg/nose-users/e5aK_ftEct4/NM2HozPk_GkJ.

Fix:

I'm not sure why it's necessary to go through all of the test class' bases and collect methods from them. Shouldn't all of the class' methods already be available on the class itself, without going up to its bases? I've removed the code that does that and confirmed that that fixes my issue with `@attr` and `unittest.TestCase` subclasses.