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

Deprecation warning in test_importlib #96280

Closed
iritkatriel opened this issue Aug 25, 2022 · 3 comments · Fixed by #96281
Closed

Deprecation warning in test_importlib #96280

iritkatriel opened this issue Aug 25, 2022 · 3 comments · Fixed by #96281
Labels
stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@iritkatriel
Copy link
Member

% ./python.exe -We -m test -v test_importlib
== CPython 3.12.0a0 (heads/main:caa2a9799a, Aug 25 2022, 18:44:45) [Clang 13.1.6 (clang-1316.0.21.2.5)]
== macOS-12.5.1-x86_64-i386-64bit little-endian
== cwd: /Users/iritkatriel/src/cpython-1/build/test_python_32671æ
== CPU count: 12
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 2.89 Run tests sequentially
0:00:00 load avg: 2.89 [1/1] test_importlib
Failed to import test module: test.test_importlib.test_abc
Traceback (most recent call last):
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/loader.py", line 385, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/loader.py", line 328, in _get_module_from_name
    __import__(name)
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_importlib/test_abc.py", line 323, in <module>
    class ResourceReaderDefaultsTests(ABCTestHarness):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_importlib/test_abc.py", line 325, in ResourceReaderDefaultsTests
    SPLIT = make_abc_subclasses(ResourceReader)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_importlib/test_abc.py", line 131, in make_abc_subclasses
    base = {kind: getattr(splitabc, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/test/test_importlib/test_abc.py", line 131, in <dictcomp>
    base = {kind: getattr(splitabc, name)
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/iritkatriel/src/cpython-1/Lib/importlib/abc.py", line 35, in __getattr__
    warnings._deprecated(f"{__name__}.{name}", remove=(3, 14))
  File "/Users/iritkatriel/src/cpython-1/Lib/warnings.py", line 514, in _deprecated
    warn(msg, DeprecationWarning, stacklevel=3)
DeprecationWarning: 'importlib.abc.ResourceReader' is deprecated and slated for removal in Python 3.14
@iritkatriel iritkatriel added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir skip news and removed skip news labels Aug 25, 2022
iritkatriel added a commit to iritkatriel/cpython that referenced this issue Aug 25, 2022
@warsaw
Copy link
Member

warsaw commented Aug 25, 2022

I'll approve the PR, but I wonder if it wouldn't be better to fix the root cause by importing from importlib.resources.abc.ResourceReader? I haven't looked at the code, but maybe that's difficult if make_abc_subclasses() is generic.

@iritkatriel
Copy link
Member Author

The Merged PR suppresses the warning, but the test needs to be rewritten before we get to 3.14.

@iritkatriel iritkatriel reopened this Aug 26, 2022
@iritkatriel iritkatriel added stale Stale PR or inactive for long period of time. stdlib Python modules in the Lib dir and removed stale Stale PR or inactive for long period of time. labels Aug 26, 2022
@jaraco
Copy link
Member

jaraco commented Sep 5, 2022

In #93963, I'm dealing with the deprecation (and ultimate removal). My recommendation there is to simply remove these tests. I'm closing this one in favor of #93963.

@jaraco jaraco closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants