New submission from R. David Murray <rdmur...@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.)

----------
assignee: michael.foord
components: Library (Lib)
keywords: easy
messages: 157842
nosy: michael.foord, r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: Add method to mark unittest.TestCases as "do not run".
type: enhancement
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14534>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to