This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Make unittest.TestCase easier to subclass
Type: Stage:
Components: Library (Lib) Versions:
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: collinwinter, georg.brandl, gvanrossum
Priority: normal Keywords: patch

Created on 2005-12-22 14:56 by collinwinter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit collinwinter, 2005-12-22 14:56 Patch against, r41775 collinwinter, 2005-12-22 14:57 My subclass, before the patch to unittest.TestCase collinwinter, 2005-12-22 14:57 My subclass, after the patch to unittest.TestCase
Messages (3)
msg49214 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2005-12-22 14:56
While 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 (and methods) meant that I had to copy
them over to my new subclass to make python happy.

The attached patch converts these __-prefixed
attributes to _-prefixed attributes, making it much
simpler to subclass TestCase. The patch is against from SVN revision 41775.

Also attached are "before" and "after" versions of my
subclass showing the impact of the patch.
msg49215 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2005-12-31 00:50
Logged In: YES 

While I haven't reviewed the code, I am +1 on the intent of
the patch. Subclassing TestCase (and other unittest
classes!) is often a pain due to too much abstraction.

(In retrospect, is really way too close a
translation of the Java junit package.  Too bad.)
msg49216 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-01-20 17:55
Logged In: YES 

Patch looks good and does no harm. Committed revisions
42115, 42116 (2.4).
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42715
2005-12-22 14:56:47collinwintercreate