Currently, the test runner keeps references to all TestCase objects until the end of the run; that means that resources referred to by TestCase attributes are kept around until the end of the test run. That can lead to false positive reports of leaked objects. (In the case that provoked this report, we were tracking Qt QObjects alive before and after each test method.)
unittest used to behave the same way (and still does for Python 2.x), but the behaviour was changed for Python 3.4. See https://bugs.python.org/issue11798
While I'd argue that individual TestCase objects should still be cleaning up after themselves anyway, it would be good to at least have the option to remove those objects once each test has been run.
Currently, the test runner keeps references to all TestCase objects until the end of the run; that means that resources referred to by TestCase attributes are kept around until the end of the test run. That can lead to false positive reports of leaked objects. (In the case that provoked this report, we were tracking Qt
QObjects alive before and after each test method.)unittestused to behave the same way (and still does for Python 2.x), but the behaviour was changed for Python 3.4. See https://bugs.python.org/issue11798While I'd argue that individual
TestCaseobjects should still be cleaning up after themselves anyway, it would be good to at least have the option to remove those objects once each test has been run.