[Python-Dev] Patch to make unittest.TestCase easier to subclass

Collin Winter collinw at gmail.com
Thu Dec 22 16:11:02 CET 2005


Hello all!

I just submitted Patch #1388073, designed to make unittest's TestCase
class easier to subclass, and I'd appreciate a review of/feedback on
the code there.

While recently working on a subclass of unittest.TestCase to support
TODO-tests, I found a large number of __-prefixed attributes in
TestCase. The presence of these attributes meant that I had to copy
several methods over to my new subclass in order for things to work.

The patch I've provided converts these __-prefixed attributes to
_-prefixed attributes, making it much simpler to subclass TestCase.
The patch is against unittest.py from SVN revision 41775.

Included with the patch are "before" and "after" versions of my
subclass showing the impact of the change to unittest.TestCase.

Thanks,
Collin Winter


More information about the Python-Dev mailing list