New submission from Zachary Ware: After 9bca86812857 (#22104), test_codecs now reports "leaked" references from ExceptionChainingTest. Previously the tests were only ever loaded one time, so each run of the tests was actually using the same set of TestCase instances; now the tests are freshly loaded before every test run and thus each run uses a new set of TestCase instances. My suspicion is that this is coming into play in ExceptionChainingTest.setUp, where the test's codec_name attribute is derived from the repr and id of the TestCase instance. However, I'm not familiar enough with the codecs code to know where it's going wrong from there.
One possible "fix" is to abuse load_tests to ensure the tests are only loaded once: _suite = None def load_tests(loader, suite, pattern): global _suite if _suite is None: _suite = suite return _suite ...which restores the old behavior, but strikes me as a fairly horrible hack. Somewhat less bad would be to just skip those tests when they've already been run before. I can't help but feel that there has to be a better solution that I can't see, though. Nick, as the original author of the test class in question, do you have any insight into a better way to fix the "leaks"? ---------- components: Tests messages: 225040 nosy: brett.cannon, ncoghlan, zach.ware priority: normal severity: normal status: open title: test_codecs "leaking" references type: behavior versions: Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22166> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com