Closed
Description
unittest.TestCase instance objects are never cleaned up - the py.test unittest module retains references to them for the whole of the py.test run. In my case, this can cause problems because the unittest.TestCase instance objects can have large objects associated with them. I believe that people writing unittest-based tests expect that their objects will be cleaned up after test execution.
I've seen this on Linux/Darwin/Windows
pytest==2.8.7
pytest-cov==2.2.1
pytest-faulthandler==1.3.0
pytest-xdist==1.14
Example:
Given this test:
import unittest
class Demo(unittest.TestCase):
def setUp(self):
self.large_object = list(range(10**6))
def testDemo(self):
assert len(self.large_object) == 10**6
The memory allocated for larg_object will be in use for the whole py.test run, even after it is done with this test.
Metadata
Metadata
Assignees
Labels
No labels