]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128816: Fix warnings in test_doctest (GH-128817)
authorThomas Grainger <tagrain@gmail.com>
Wed, 15 Jan 2025 13:05:59 +0000 (13:05 +0000)
committerGitHub <noreply@github.com>
Wed, 15 Jan 2025 13:05:59 +0000 (15:05 +0200)
* Fix a deprecation warning for using importlib.resources.abc.ResourceReader.
* Fix an import warning when importing readline (if it has not yet been imported).

Lib/test/test_doctest/test_doctest.py

index b1e165fe16b54fa49374fa594e7d99ad901ec143..a4a49298bab3be70d878e8f9f57625df7511cd83 100644 (file)
@@ -2860,7 +2860,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)
@@ -2869,6 +2869,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):