diff options
author | Dan Wandschneider <daniel.wandschneider@schrodinger.com> | 2016-11-07 18:24:10 -0800 |
---|---|---|
committer | Dan Wandschneider <daniel.wandschneider@schrodinger.com> | 2016-11-07 18:32:56 -0800 |
commit | e46e653794e3b72d7cc02d374086191224221501 (patch) | |
tree | ace251d52c2070d4b1fa021755cc4ae5eca0a34e /_pytest | |
parent | 07af307e4ae7670f52569a12993e715b79a97dd4 (diff) | |
download | pytest-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.py | 3 |
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 |