https://github.com/python/cpython/commit/599be687ec7327c30c6469cf743aa4ee9e82232d
commit: 599be687ec7327c30c6469cf743aa4ee9e82232d
branch: main
author: Thomas Grainger <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2025-01-15T15:05:59+02:00
summary:

gh-128816: Fix warnings in test_doctest (GH-128817)

* Fix a deprecation warning for using importlib.resources.abc.ResourceReader.
* Fix an import warning when importing readline (if it has not yet been 
imported).

files:
M Lib/test/test_doctest/test_doctest.py

diff --git a/Lib/test/test_doctest/test_doctest.py 
b/Lib/test/test_doctest/test_doctest.py
index b1e165fe16b54f..a4a49298bab3be 100644
--- a/Lib/test/test_doctest/test_doctest.py
+++ b/Lib/test/test_doctest/test_doctest.py
@@ -2860,7 +2860,7 @@ def test_testfile(): r"""
     >>> _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 @@ def get_data(self, path):
         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):

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to