Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
unittest instance objects exist for the lifetime of the py.test run #1649
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
Given this test:
The memory allocated for larg_object will be in use for the whole py.test run, even after it is done with this test.