summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-06-24 18:28:04 (GMT)
committerGitHub <noreply@github.com>2022-06-24 18:28:04 (GMT)
commit0a40025b803a8dc1d604538e317992827ab96625 (patch)
tree19ad8727b1e4de2ab472caf077790c36ba3a5181
parent50a5ab2c0bf7bd10d85e80c9f71a7b7245a0682a (diff)
downloadcpython-0a40025b803a8dc1d604538e317992827ab96625.zip
cpython-0a40025b803a8dc1d604538e317992827ab96625.tar.gz
cpython-0a40025b803a8dc1d604538e317992827ab96625.tar.bz2
gh-94217: Skip import tests when _testcapi is a builtin (GH-94218)
-rw-r--r--Lib/test/test_importlib/extension/test_finder.py6
-rw-r--r--Lib/test/test_importlib/extension/test_loader.py8
2 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_importlib/extension/test_finder.py b/Lib/test/test_importlib/extension/test_finder.py
index b6663a4..1d5b6e7 100644
--- a/Lib/test/test_importlib/extension/test_finder.py
+++ b/Lib/test/test_importlib/extension/test_finder.py
@@ -3,7 +3,7 @@ from test.test_importlib import abc, util
machinery = util.import_importlib('importlib.machinery')
import unittest
-import warnings
+import sys
class FinderTests(abc.FinderTests):
@@ -13,6 +13,10 @@ class FinderTests(abc.FinderTests):
def setUp(self):
if not self.machinery.EXTENSION_SUFFIXES:
raise unittest.SkipTest("Requires dynamic loading support.")
+ if util.EXTENSIONS.name in sys.builtin_module_names:
+ raise unittest.SkipTest(
+ f"{util.EXTENSIONS.name} is a builtin module"
+ )
def find_spec(self, fullname):
importer = self.machinery.FileFinder(util.EXTENSIONS.path,
diff --git a/Lib/test/test_importlib/extension/test_loader.py b/Lib/test/test_importlib/extension/test_loader.py
index 5080009..8570c6b 100644
--- a/Lib/test/test_importlib/extension/test_loader.py
+++ b/Lib/test/test_importlib/extension/test_loader.py
@@ -20,6 +20,10 @@ class LoaderTests(abc.LoaderTests):
def setUp(self):
if not self.machinery.EXTENSION_SUFFIXES:
raise unittest.SkipTest("Requires dynamic loading support.")
+ if util.EXTENSIONS.name in sys.builtin_module_names:
+ raise unittest.SkipTest(
+ f"{util.EXTENSIONS.name} is a builtin module"
+ )
self.loader = self.machinery.ExtensionFileLoader(util.EXTENSIONS.name,
util.EXTENSIONS.file_path)
@@ -97,6 +101,10 @@ class MultiPhaseExtensionModuleTests(abc.LoaderTests):
if not self.machinery.EXTENSION_SUFFIXES:
raise unittest.SkipTest("Requires dynamic loading support.")
self.name = '_testmultiphase'
+ if self.name in sys.builtin_module_names:
+ raise unittest.SkipTest(
+ f"{self.name} is a builtin module"
+ )
finder = self.machinery.FileFinder(None)
self.spec = importlib.util.find_spec(self.name)
assert self.spec