]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-128816: Fix warnings in test_doctest (GH-128817) (GH-128870)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 16 Jan 2025 08:57:14 +0000 (09:57 +0100)
committerGitHub <noreply@github.com>
Thu, 16 Jan 2025 08:57:14 +0000 (08:57 +0000)
* Fix a deprecation warning for using importlib.resources.abc.ResourceReader.
* Fix an import warning when importing readline (if it has not yet been imported).
(cherry picked from commit 599be687ec7327c30c6469cf743aa4ee9e82232d)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Lib/test/test_doctest/test_doctest.py

index 286c3ecfbc9239f216371971f86dc2cc9277d450..7da6b983359041f9d0f49fa0addef750cff05d58 100644 (file)
@@ -2872,7 +2872,7 @@ Test the verbose output:
     >>> _colorize.COLORIZE = save_colorize
 """
 
-class TestImporter(importlib.abc.MetaPathFinder, importlib.abc.ResourceLoader):
+class TestImporter(importlib.abc.MetaPathFinder):
 
     def find_spec(self, fullname, path, target=None):
         return importlib.util.spec_from_file_location(fullname, path, loader=self)
@@ -2881,6 +2881,12 @@ class TestImporter(importlib.abc.MetaPathFinder, importlib.abc.ResourceLoader):
         with open(path, mode='rb') as f:
             return f.read()
 
+    def exec_module(self, module):
+        raise ImportError
+
+    def create_module(self, spec):
+        return None
+
 class TestHook:
 
     def __init__(self, pathdir):