Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't keep references to TestCase objects #191

Open
mdickinson opened this issue Mar 2, 2020 · 1 comment
Open

Don't keep references to TestCase objects #191

mdickinson opened this issue Mar 2, 2020 · 1 comment

Comments

@mdickinson
Copy link
Contributor

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.

@mdickinson
Copy link
Contributor Author

For the record, here's the corresponding commit for CPython (since it's not 100% trivial to extract it from the issue discussion): python/cpython@eb97368

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant