Skip to content

ResourceWarning: unclosed file <_io.BufferedReader name=8> #305

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

Closed
SnarkBoojum opened this issue Aug 10, 2018 · 8 comments
Closed

ResourceWarning: unclosed file <_io.BufferedReader name=8> #305

SnarkBoojum opened this issue Aug 10, 2018 · 8 comments

Comments

@SnarkBoojum
Copy link

The testsuite has a small warning when run with Python 3.6.6:

platform linux -- Python 3.6.6, pytest-3.6.4, py-1.5.4, pluggy-0.6.0
setuptools version 39.2.0 from '/usr/lib/python3/dist-packages/setuptools/__init__.py'
setuptools_scm version 3.1.0 from '/usr/lib/python3/dist-packages/setuptools_scm/__init__.py'
rootdir: /tmp/autopkgtest.1UXGDe/build.GNi/src, inifile: tox.ini
collected 124 items / 6 deselected

testing/test_basic_api.py ..............                                 [ 11%]
testing/test_config.py .....                                             [ 16%]
testing/test_file_finder.py ..............................               [ 41%]
testing/test_functions.py ......................                         [ 60%]
testing/test_git.py ..................                                   [ 75%]
testing/test_main.py .                                                   [ 76%]
testing/test_mercurial.py ...............                                [ 88%]
testing/test_regressions.py .s                                           [ 90%]
testing/test_version.py ...........                                      [100%]
============= 117 passed, 1 skipped, 6 deselected in 30.97 seconds =============
Exception ignored in: <_io.FileIO name=8 mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.BufferedReader name=8>

since I didn't see it in 3.0.6, I guess the change is recent...

@RonnyPfannschmidt
Copy link
Contributor

in 3.1 i set up warnings to errors to iron out a set of internal mistakes

i didn't see the error you posted however - what distro is that?

@SnarkBoojum
Copy link
Author

Debian unstable ; I'm the packager for setuptools_scm and saw it while trying to update the package.

@RonnyPfannschmidt
Copy link
Contributor

@SnarkBoojum does the test env mask stuff like the $USER, i recall that masking those env vars might trigger a enquiry to the system dbus (observed that on fedora at least)

@RonnyPfannschmidt
Copy link
Contributor

@SnarkBoojum on a unrelated note - its a pleasure to see that debian is one of the few distros that tests against the installed package

@SnarkBoojum
Copy link
Author

SnarkBoojum commented Aug 10, 2018

If I run the tests as myself, I see that it happens during the git test:

testing/test_git.py ...Exception ignored in: <_io.FileIO name=8 mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.BufferedReader name=8>
...............                                                             [ 71%]

so it's not just the autopkgtest environment having strange interactions : there is something fishy.

@SnarkBoojum
Copy link
Author

I ran:

pytest-3 testing/test_git.py::test_file_finder_no_history

and saw the warning.

RonnyPfannschmidt added a commit to RonnyPfannschmidt/setuptools_scm that referenced this issue Aug 10, 2018
@RonnyPfannschmidt
Copy link
Contributor

@SnarkBoojum thanks for the investigation, i could reproduce - pr upcoming

@RonnyPfannschmidt
Copy link
Contributor

@SnarkBoojum the issue existed since longer, the the switch to failing on warnings just made it more apparent

pytest needs a tool for better tracking that as i blatantly missed the message due to green test results

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

2 participants