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: unittest keeps references to test cases alive
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.3, Python 3.4, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, michael.foord, pitrou, serhiy.storchaka, tshepang
Priority: normal Keywords:

Created on 2013-03-23 22:06 by ezio.melotti, last changed 2022-04-11 14:57 by admin.

Messages (3)
msg185100 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-03-23 22:06
After the subtests commit (5c09e1c57200/#16997), test_queue started showing the following warning:
Warning -- threading._dangling was modified by test_queue
1 test altered the execution environment:

The warning was caused by the fact that the TestCase subclasses in test_queue kept references to the thread, but before 5c09e1c57200 these subclasses (and hence the references to the thread) were destroyed before the regrtest check for threading._dangling, whereas now they are kept alive (due to Lib/unittest/, that adds a reference to the TestCase even in case of success).  I now fixed the warning in test_queue (1747e50fca55), however unittest should probably avoid keeping alive TestCases when they are not needed anymore.

See also #9815.

(Thanks to Antoine for the help while I was debugging the issue.)
msg185195 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2013-03-25 11:52
Issue 11798 is somewhat related.
msg331666 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-12-11 23:25
Does this issue still relevant?
Date User Action Args
2022-04-11 14:57:43adminsetstatus: pending -> open
github: 61736
2018-12-11 23:25:10serhiy.storchakasetstatus: open -> pending
nosy: + serhiy.storchaka
messages: + msg331666

2013-10-06 20:01:45tshepangsetnosy: + tshepang
2013-10-06 19:31:00terry.reedysetversions: - Python 3.2
2013-03-25 11:52:44michael.foordsetmessages: + msg185195
2013-03-23 22:06:48ezio.melotticreate