The TestProgram class will find all tests in the file based on whether or not they are subclassed from TestCase. It is not possible to prevent TestProgram from including tests, such as base classes. For example, have BaseTest(unittest.TestCase) class that implements several test functions. However, these test functions can not operate correctly on their own...the class must be subclassed for proper operation (such as TestBlah(BaseTest)). This patch changes the "auto find" feature to ignore any classes that start with an underscore, allowing you to define base classes in the same file, but not have their tests run.
No, the feature is not present in current unittest; the patch is still applicable. I'm concerned with backward compatibility, though. To achieve the same result, the common usage is a mixin class. See for example Lib/test/test_codecencoding_cn.py: class BaseTest: ... test functions, setup, teardown ... class TestBlah(BaseTest, unittest.TestCase): ... subclass here ... This is not too bad. I suggest to close this issue as "won't fix".