classification
Title: Avoid using a pseudo-dict for _type_equality_funcs in unittest
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: MarkRoddy, benjamin.peterson, eric.araujo, ezio.melotti, gz, michael.foord, python-dev
Priority: normal Keywords: patch

Created on 2011-07-13 00:05 by gz, last changed 2011-07-15 15:03 by eric.araujo. This issue is now closed.

Files
File name Uploaded Description Edit
avoid_TestCase_refcycle.diff gz, 2011-07-13 00:20
Messages (10)
msg140217 - (view) Author: Martin (gz) Date: 2011-07-13 00:05
The fix for issue 10326 landing on Python 2.7 trunk has interfered with a hack I wrote in Bazaar to break the reference cycles the private `unittest.TestCase._type_equality_funcs` member creates.

As the change to make pickling work is nearly enough to avoid the test and the dict referencing each other, it would be good to remove that breakage and the need for the hack in the first place.

Downstream bug:

<https://bugs.launchpad.net/ubuntu/+source/bzr/+bug/809048>
msg140218 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2011-07-13 00:08
It isn't clear to me exactly what fix you are suggesting for Python 2.7?
msg140219 - (view) Author: Martin (gz) Date: 2011-07-13 00:12
Michael: See attached patch, that should merge up to Python 3 without too much pain as well.
msg140220 - (view) Author: Roundup Robot (python-dev) Date: 2011-07-13 00:19
New changeset 02a591131360 by Benjamin Peterson in branch '2.7':
this can be done without a custom dict (also fixes #12544)
http://hg.python.org/cpython/rev/02a591131360

New changeset 842f5ed06255 by Benjamin Peterson in branch '3.2':
this can be done without a custom dict (also fixes #12544)
http://hg.python.org/cpython/rev/842f5ed06255

New changeset 47a36d2d2b44 by Benjamin Peterson in branch 'default':
merge 3.2 (#12544)
http://hg.python.org/cpython/rev/47a36d2d2b44
msg140221 - (view) Author: Martin (gz) Date: 2011-07-13 00:20
...typo in the first patch, this one should be okay. But... already landed without the testcase?
msg140255 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-13 14:27
What’s the typo?

About the test case: Benjamin probably judged that testing this internal detail was not worth it, as long as the code was readable and working.
msg140256 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-07-13 14:29
Actually, what happened was I saw the bug report, didn't see your patch, and started working on my own patch. I see we came to roughly the same conclusion, though. :) About the test, I'm not sure testcases having no cyclic references is part of the guarantee of the API. Perhaps Michael can chime in on that.
msg140401 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2011-07-15 10:58
I wouldn't object to having a cyclic reference test for TestCase, although if it ever becomes a problem for the development of unittest we may have to disable it again. I think Benjamin said he would like to modify the test from Martin's patch.
msg140413 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-07-15 14:50
Done.

2011/7/15 Michael Foord <report@bugs.python.org>:
>
> Michael Foord <michael@voidspace.org.uk> added the comment:
>
> I wouldn't object to having a cyclic reference test for TestCase, although if it ever becomes a problem for the development of unittest we may have to disable it again. I think Benjamin said he would like to modify the test from Martin's patch.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue12544>
> _______________________________________
>
msg140414 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-15 15:03
FTR, some assertions about GC are embedded in the tests, for example test_set.
History
Date User Action Args
2011-07-15 15:03:01eric.araujosetmessages: + msg140414
2011-07-15 14:50:35benjamin.petersonsetmessages: + msg140413
2011-07-15 10:58:36michael.foordsetmessages: + msg140401
2011-07-13 14:41:22ezio.melottisetnosy: + ezio.melotti
2011-07-13 14:30:00benjamin.petersonsetmessages: + msg140256
2011-07-13 14:27:03eric.araujosetnosy: + eric.araujo, benjamin.peterson
messages: + msg140255
2011-07-13 00:20:27gzsetfiles: + avoid_TestCase_refcycle.diff

messages: + msg140221
2011-07-13 00:19:54benjamin.petersonsetstatus: open -> closed
resolution: fixed
2011-07-13 00:19:07python-devsetnosy: + python-dev
messages: + msg140220
2011-07-13 00:15:51gzsetfiles: - avoid_TestCase_refcycle.diff
2011-07-13 00:12:25gzsetmessages: + msg140219
2011-07-13 00:11:28gzsetfiles: + avoid_TestCase_refcycle.diff
keywords: + patch
2011-07-13 00:08:57michael.foordsetassignee: michael.foord
messages: + msg140218
2011-07-13 00:05:53gzcreate