mirror of https://github.com/python/cpython
gh-104090: Fix unittest collectedDurations resources leak (#106795)
This commit is contained in:
parent
e6f96cf9c6
commit
70b961ed93
|
@ -166,7 +166,8 @@ class TestResult(object):
|
|||
"""
|
||||
# support for a TextTestRunner using an old TestResult class
|
||||
if hasattr(self, "collectedDurations"):
|
||||
self.collectedDurations.append((test, elapsed))
|
||||
# Pass test repr and not the test object itself to avoid resources leak
|
||||
self.collectedDurations.append((str(test), elapsed))
|
||||
|
||||
def wasSuccessful(self):
|
||||
"""Tells whether or not this result was a success."""
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Avoid creating a reference to the test object in :meth:`~unittest.TestResult.collectedDurations`.
|
Loading…
Reference in New Issue