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

Improve localizing ResourceWarnings #131

Closed
d-maurer opened this issue Apr 21, 2022 · 1 comment · Fixed by #133
Closed

Improve localizing ResourceWarnings #131

d-maurer opened this issue Apr 21, 2022 · 1 comment · Fixed by #133

Comments

@d-maurer
Copy link
Contributor

ResourceWarnings are often issued during garbage collection. Those reports are non local and therefore it is difficult to find the resource's origin.

Python's tracemalloc allows to keep track of allocation tracebacks and if recorded such a traceback is included in the ResourceWarning. But the report is still not associated with a particular test, and it is often not easy to properly configure tracemalloc (regarding traceback depth) to reliably obtain the information which test has caused the problem.

I propose an new option --gc-after-test. If set, gc.collect is called after each test (similar to --report-refcounts); this way, a ResourceWarning can be easily associated with the test revealing the resource problem.

Opinions?

@jugmac00
Copy link
Member

Sounds awesome!

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

Successfully merging a pull request may close this issue.

2 participants