[Python-Dev] Tweaking the stdlib test infrastructure
collinw at gmail.com
Tue Apr 24 02:39:42 CEST 2007
Fast and simple: I want all stdlib test cases to stop subclassing
unittest.TestCase and start subclassing test_support.TestCase.
Why: With a single parent class common to the entire stdlib, adding
new functionality/testing instruments to *every single test at once*
becomes trivial. One example would be to move "regrtest -R"'s focus
from module-level refleaks to test case-level refleaks (that is,
looped execution of individual test cases, rather than test modules).
I intend to implement this new refleak checking soon, if this base
change goes ahead.
How: At first, test_support.TestCase could be as simple as "TestCase =
unittest.TestCase". Once we want to extend the test harness's
capabilities, we change it to "class TestCase(unittest.TestCase): blah
blah blah". All code under Lib/test/ is changed to subclass the proper
class. test_support.run_unittest() can be modified to make sure that
incoming classes inherit as they're supposed to.
But that sounds like a lot of work: yes, but that's what we have
regexes for. Most of this work can be done with a few global
So: any objections to making this change?
More information about the Python-Dev