gh-109625: Move _ready_to_import() from test_import to support.import_helper (#109626)

This commit is contained in:
Nikita Sobolev 2023-09-21 10:39:36 +03:00 committed by GitHub
parent 712cb173f8
commit 115c49ad5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 34 deletions

View file

@ -33,7 +33,7 @@ except ImportError:
from test.support import cpython_only
from test.support import MISSING_C_DOCSTRINGS, ALWAYS_EQ
from test.support.import_helper import DirsOnSysPath
from test.support.import_helper import DirsOnSysPath, ready_to_import
from test.support.os_helper import TESTFN
from test.support.script_helper import assert_python_ok, assert_python_failure
from test import inspect_fodder as mod
@ -43,8 +43,6 @@ from test import inspect_stock_annotations
from test import inspect_stringized_annotations
from test import inspect_stringized_annotations_2
from test.test_import import _ready_to_import
# Functions tested in this suite:
# ismodule, isclass, ismethod, isfunction, istraceback, isframe, iscode,
@ -4954,7 +4952,7 @@ def foo():
def test_getsource_reload(self):
# see issue 1218234
with _ready_to_import('reload_bug', self.src_before) as (name, path):
with ready_to_import('reload_bug', self.src_before) as (name, path):
module = importlib.import_module(name)
self.assertInspectEqual(path, module)
with open(path, 'w', encoding='utf-8') as src: