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
test_importlib logs ResourceWarning: test_path.CommonTests.test_importing_module_as_side_effect() #85179
Comments
It seems like the issue was introduced in bpo-39791 by: commit 843c277
The warning: $ ./python -X tracemalloc=20 -m test test_importlib -m test.test_importlib.test_path.CommonTests.test_importing_module_as_side_effect -v
== CPython 3.10.0a0 (heads/importlib_typing:d1b0d052cf, Jun 17 2020, 16:09:52) [GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]
== Linux-5.6.18-300.fc32.x86_64-x86_64-with-glibc2.31 little-endian
== cwd: /home/vstinner/python/master/build/test_python_67972
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 0.44 Run tests sequentially
0:00:00 load avg: 0.44 [1/1] test_importlib
test_importing_module_as_side_effect (test.test_importlib.test_path.CommonTests) ... /home/vstinner/python/master/Lib/contextlib.py:124: ResourceWarning: unclosed file <_io.BufferedReader name='/home/vstinner/python/master/Lib/test/test_importlib/data01/utf-8.file'>
next(self.gen)
Object allocated at (most recent call last):
File "/home/vstinner/python/master/Lib/unittest/runner.py", lineno 176
test(result)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 84
return self.run(*args, **kwds)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 122
test(result)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 84
return self.run(*args, **kwds)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 122
test(result)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 84
return self.run(*args, **kwds)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 122
test(result)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 84
return self.run(*args, **kwds)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 122
test(result)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 84
return self.run(*args, **kwds)
File "/home/vstinner/python/master/Lib/unittest/suite.py", lineno 122
test(result)
File "/home/vstinner/python/master/Lib/unittest/case.py", lineno 653
return self.run(*args, **kwds)
File "/home/vstinner/python/master/Lib/unittest/case.py", lineno 593
self._callTestMethod(testMethod)
File "/home/vstinner/python/master/Lib/unittest/case.py", lineno 550
method()
File "/home/vstinner/python/master/Lib/test/test_importlib/util.py", lineno 509
self.execute(data01.__name__, 'utf-8.file')
File "/home/vstinner/python/master/Lib/test/test_importlib/test_path.py", lineno 10
with resources.path(package, path):
File "/home/vstinner/python/master/Lib/contextlib.py", lineno 117
return next(self.gen)
File "/home/vstinner/python/master/Lib/importlib/resources.py", lineno 118
opener_reader = reader.open_resource(norm_resource)
File "/home/vstinner/python/master/Lib/importlib/abc.py", lineno 465
return self.files().joinpath(resource).open('rb')
File "/home/vstinner/python/master/Lib/pathlib.py", lineno 1238
return io.open(self, mode, buffering, encoding, errors, newline,
ok Ran 1 test in 0.134s OK == Tests result: SUCCESS == 1 test OK. Total duration: 6.2 sec |
(allhub) ➜ cpython git:(master) ✗ ./python.exe -X tracemalloc=20 -m test test_importlib -m test.test_importlib.test_path.CommonTests.test_importing_module_as_side_effect -v ---------------------------------------------------------------------- Ran 1 test in 0.061s OK == Tests result: SUCCESS == 1 test OK. Total duration: 6.5 sec |
Alright, this issue was fixed by: commit 2fb5f03 (HEAD)
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: