This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients michael.foord, r.david.murray
Date 2012-04-09.13:10:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333977053.0.0.776415854805.issue14534@psf.upfronthosting.co.za>
In-reply-to
Content
A common pattern in testing is to have a base test class that implements test methods, and subclasses that provide various data that drives the tests to be run in different ways.  It is convenient for the base class to inherit from TestCase, but this causes the normal test loader to load it as a test to be run, when most times it can't run by itself.

My proposed solution is to make test case loading depend on an attribute of the class rather than the fact that it subclasses TestCase.  TestCase would then have the attribute set to True by default.  A decorator would be provided that sets the attribute to False, since that would make it visually obvious which TestCases are base classes and not to be loaded.

(Note: once this is available the 'best practices' description of test file construction in the documentation for the stdlib 'test' module should be updated to use it.)
History
Date User Action Args
2012-04-09 13:10:53r.david.murraysetrecipients: + r.david.murray, michael.foord
2012-04-09 13:10:52r.david.murraysetmessageid: <1333977053.0.0.776415854805.issue14534@psf.upfronthosting.co.za>
2012-04-09 13:10:52r.david.murraylinkissue14534 messages
2012-04-09 13:10:52r.david.murraycreate