[Python-Dev] Tweaking the stdlib test infrastructure

Walter Dörwald walter at livinglogic.de
Tue Apr 24 09:19:37 CEST 2007


Collin Winter wrote:
> 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.

+1

> [...]

Servus,
    Walter


More information about the Python-Dev mailing list