question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TST: --open-files did not catch ResourceWarning

See original GitHub issue

Is this is not really an issue, feel free to close, as I am not familiar with the internals of open files check. Example log: https://travis-ci.org/astropy/astropy/jobs/442639768

It seems weird to me that --open-files option still reported passing despite the presence of following warning:

sys:1: ResourceWarning: unclosed file <_io.BufferedWriter name=13>

cc @drdavella

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
saimncommented, Nov 13, 2018

Actually there is a way to show a traceback for ResourceWarning, with tracemalloc: python3 -Wd -X tracemalloc=5. From https://pythondev.readthedocs.io/debug_tools.html#resourcewarning, and thanks to @vstinner !

1reaction
drdavellacommented, Oct 31, 2018

IIRC, I think the problem is that many of them come from other libraries. If that’s the case, we would want to somehow filter to get only the ones that come from astropy, but I’m not sure there’s a straightforward way to do that in Python.

That’s one of the reasons I haven’t really made any progress on implementing this functionality in pytest-openfiles, although it would still be really useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make pytest fail on ResourceWarning (unclosed files)
Try this: #test_example.py import pytest @pytest.mark.filterwarnings("error") def test_resourcewarning(): open('/dev/null').
Read more >
test_multiprocessing_spawn ResourceWarning with -Werror
The question is why a resource warning is not emitted in normal case, with standard stdin. Proposed patch closes sys.
Read more >
Changelog — pybedtools 0.9.0 documentation - GitHub Pages
Fixed a long-standing issue where streaming BedTool objects did not close their open file handles (stdout). When working with many (i.e. tens of...
Read more >
[Django] #19905: ResourceWarning in formtools tests - Google Groups
2. We do think that open files provided to forms with file fields should be explicitly closed at some point in the code...
Read more >
#19905 (ResourceWarning in formtools tests) – Django
We do think that open files provided to forms with file fields should be explicitly closed at some point in the code (and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found