summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-06-08 19:00:04 (GMT)
committerGitHub <noreply@github.com>2023-06-08 19:00:04 (GMT)
commit8698fa83f6c226d35af0367e40dd4387fcccbe40 (patch)
treef132abf43e01fde9ca91ad87a3c42dda860d109f /Lib/test
parent1f90b2f57a21b48858a2c60c2c1e59b8ff9f63b7 (diff)
downloadcpython-8698fa83f6c226d35af0367e40dd4387fcccbe40.zip
cpython-8698fa83f6c226d35af0367e40dd4387fcccbe40.tar.gz
cpython-8698fa83f6c226d35af0367e40dd4387fcccbe40.tar.bz2
[3.12] gh-104310: Rename the New Function in importlib.util (gh-105255) (gh-105518)
The original name wasn't as clear as it could have been. This change includes the following: * rename the function * change the default value for "disable_check" to False * add clues to the docstring that folks should probably not use the function --------- (cherry picked from commit 34c63b86d3c33a85acf55a0c5c118304754e145d) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_importlib/test_util.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/Lib/test/test_importlib/test_util.py b/Lib/test/test_importlib/test_util.py
index 0be5049..e967adc 100644
--- a/Lib/test/test_importlib/test_util.py
+++ b/Lib/test/test_importlib/test_util.py
@@ -653,7 +653,7 @@ class MagicNumberTests(unittest.TestCase):
@unittest.skipIf(_interpreters is None, 'subinterpreters required')
-class AllowingAllExtensionsTests(unittest.TestCase):
+class IncompatibleExtensionModuleRestrictionsTests(unittest.TestCase):
ERROR = re.compile("^<class 'ImportError'>: module (.*) does not support loading in subinterpreters")
@@ -678,8 +678,8 @@ class AllowingAllExtensionsTests(unittest.TestCase):
@unittest.skipIf(_testsinglephase is None, "test requires _testsinglephase module")
def test_single_phase_init_module(self):
script = textwrap.dedent('''
- import importlib.util
- with importlib.util.allowing_all_extensions():
+ from importlib.util import _incompatible_extension_module_restrictions
+ with _incompatible_extension_module_restrictions(disable_check=True):
import _testsinglephase
''')
with self.subTest('check disabled, shared GIL'):
@@ -688,8 +688,8 @@ class AllowingAllExtensionsTests(unittest.TestCase):
self.run_with_own_gil(script)
script = textwrap.dedent(f'''
- import importlib.util
- with importlib.util.allowing_all_extensions(False):
+ from importlib.util import _incompatible_extension_module_restrictions
+ with _incompatible_extension_module_restrictions(disable_check=False):
import _testsinglephase
''')
with self.subTest('check enabled, shared GIL'):
@@ -713,8 +713,8 @@ class AllowingAllExtensionsTests(unittest.TestCase):
''')
script = prescript + textwrap.dedent('''
- import importlib.util
- with importlib.util.allowing_all_extensions():
+ from importlib.util import _incompatible_extension_module_restrictions
+ with _incompatible_extension_module_restrictions(disable_check=True):
module = module_from_spec(spec)
loader.exec_module(module)
''')
@@ -724,8 +724,8 @@ class AllowingAllExtensionsTests(unittest.TestCase):
self.run_with_own_gil(script)
script = prescript + textwrap.dedent('''
- import importlib.util
- with importlib.util.allowing_all_extensions(False):
+ from importlib.util import _incompatible_extension_module_restrictions
+ with _incompatible_extension_module_restrictions(disable_check=False):
module = module_from_spec(spec)
loader.exec_module(module)
''')
@@ -738,8 +738,8 @@ class AllowingAllExtensionsTests(unittest.TestCase):
@unittest.skipIf(_testmultiphase is None, "test requires _testmultiphase module")
def test_complete_multi_phase_init_module(self):
script = textwrap.dedent('''
- import importlib.util
- with importlib.util.allowing_all_extensions():
+ from importlib.util import _incompatible_extension_module_restrictions
+ with _incompatible_extension_module_restrictions(disable_check=True):
import _testmultiphase
''')
with self.subTest('check disabled, shared GIL'):
@@ -748,8 +748,8 @@ class AllowingAllExtensionsTests(unittest.TestCase):
self.run_with_own_gil(script)
script = textwrap.dedent(f'''
- import importlib.util
- with importlib.util.allowing_all_extensions(False):
+ from importlib.util import _incompatible_extension_module_restrictions
+ with _incompatible_extension_module_restrictions(disable_check=False):
import _testmultiphase
''')
with self.subTest('check enabled, shared GIL'):