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.

classification
Title: unittest.TestCase._result is very likely to collide (and break) with application-defined TestCase attributes
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: exarkun, ivank, michael.foord
Priority: normal Keywords: patch

Created on 2009-05-20 17:56 by exarkun, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
rename-results.patch exarkun, 2009-05-20 18:08
Messages (4)
msg88124 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-05-20 17:56
r72219 introduced an `_result´ attribute to `TestCase´.  As `TestCase´
is designed specifically with the intent that applications should
subclass it -- and frequently -- I would suggest that the attribute be
given a name less likely to collide with a name chosen by application
code.  Given the huge quantity of `TestCase´ subclasses, it will likely
be a great time saver to address the collision in CPython rather than in
each application.
msg88126 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-05-20 18:08
Here's a patch which renames `_result´ to `_resultForDoCleanups´. 
Another possibility would be for `doCleanups´ to take the result object
as an argument.  This would make it harder for applications to call
directly, though (I've never wanted to run cleanups early, though).
msg88131 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-05-20 18:43
Patch is fine. I'll apply shortly. There was a specific use case for
being able to call doCleanups directly which was why the results object
needed to be stored.
msg88172 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-05-21 22:57
Committed in revision 72812.
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50322
2009-05-21 22:57:52michael.foordsetstatus: open -> closed
resolution: fixed
messages: + msg88172
2009-05-20 18:43:20michael.foordsetmessages: + msg88131
2009-05-20 18:15:40georg.brandlsetassignee: michael.foord

nosy: + michael.foord
2009-05-20 18:08:20exarkunsetfiles: + rename-results.patch
keywords: + patch
messages: + msg88126
2009-05-20 18:02:50ivanksetnosy: + ivank
2009-05-20 17:56:32exarkuncreate