[New-bugs-announce] [issue14534] Add method to mark unittest.TestCases as "do not run".
R. David Murray
report at bugs.python.org
Mon Apr 9 15:10:53 CEST 2012
New submission from R. David Murray <rdmurray at bitdance.com>:
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.)
components: Library (Lib)
nosy: michael.foord, r.david.murray
stage: needs patch
title: Add method to mark unittest.TestCases as "do not run".
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce