Issue 6072: unittest.TestCase._result is very likely to collide (and break) with application-defined TestCase attributes (original) (raw)

Issue6072

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:49 admin set github: 50322
2009-05-21 22:57:52 michael.foord set status: open -> closedresolution: fixedmessages: +
2009-05-20 18:43:20 michael.foord set messages: +
2009-05-20 18:15:40 georg.brandl set assignee: michael.foordnosy: + michael.foord
2009-05-20 18:08:20 exarkun set files: + rename-results.patchkeywords: + patchmessages: +
2009-05-20 18:02:50 ivank set nosy: + ivank
2009-05-20 17:56:32 exarkun create