8000 [3.13] gh-128816: Fix warnings in test_doctest (GH-128817) by miss-islington · Pull Request #128870 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-128816: Fix warnings in test_doctest (GH-128817) #128870

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

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).
(cherry picked from commit 599be68)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
  • Loading branch information
graingert authored and miss-islington committed Jan 15, 2025
commit c57b161b09535e38fe0b2f91aa957f0862f643ca
8 changes: 7 additions & 1 deletion Lib/test/test_doctest/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,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)
Expand All @@ -2881,6 +2881,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):
Expand Down
Loading
0