summaryrefslogtreecommitdiff
path: root/_pytest
diff options
context:
space:
mode:
authorDan Wandschneider <daniel.wandschneider@schrodinger.com>2016-11-07 18:24:10 -0800
committerDan Wandschneider <daniel.wandschneider@schrodinger.com>2016-11-07 18:32:56 -0800
commite46e653794e3b72d7cc02d374086191224221501 (patch)
treeace251d52c2070d4b1fa021755cc4ae5eca0a34e /_pytest
parent07af307e4ae7670f52569a12993e715b79a97dd4 (diff)
downloadpytest-e46e653794e3b72d7cc02d374086191224221501.tar.gz
Clean up unittest TestCase objects after tests are complete (#1649).
Fix #1649 Users of unittest style TestCases will create expensive objects in setUp. We should clean up TestCase instances that are lying around so that they don't fill up memory.
Diffstat (limited to '_pytest')
-rw-r--r--_pytest/unittest.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/_pytest/unittest.py b/_pytest/unittest.py
index 47868f448..4355efe70 100644
--- a/_pytest/unittest.py
+++ b/_pytest/unittest.py
@@ -94,6 +94,9 @@ class TestCaseFunction(pytest.Function):
def teardown(self):
if hasattr(self._testcase, 'teardown_method'):
self._testcase.teardown_method(self._obj)
+ # Allow garbage collection on TestCase instance attributes.
+ self._testcase = None
+ self._obj = None
def startTest(self, testcase):
pass