aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_code.py
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2024-04-03 15:11:36 +0200
committerGitHub <noreply@github.com>2024-04-03 15:11:36 +0200
commitea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e (patch)
tree7fc58f8dcd7513427c7ea2ff9d7bad523be1118a /Lib/test/test_code.py
parent2ec6bb4111d2c03c1cac02b27c74beee7e5a2a05 (diff)
downloadcpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.tar.gz
cpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.zip
gh-116303: Skip test module dependent tests if test modules are unavailable (#117341)
Diffstat (limited to 'Lib/test/test_code.py')
-rw-r--r--Lib/test/test_code.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index 46bebfc7af6..ecd1e82a6db 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -143,9 +143,8 @@ from test.support import (cpython_only,
check_impl_detail, requires_debug_ranges,
gc_collect)
from test.support.script_helper import assert_python_ok
-from test.support import threading_helper
-from test.support.bytecode_helper import (BytecodeTestCase,
- instructions_with_positions)
+from test.support import threading_helper, import_helper
+from test.support.bytecode_helper import instructions_with_positions
from opcode import opmap, opname
COPY_FREE_VARS = opmap['COPY_FREE_VARS']
@@ -176,7 +175,7 @@ class CodeTest(unittest.TestCase):
@cpython_only
def test_newempty(self):
- import _testcapi
+ _testcapi = import_helper.import_module("_testcapi")
co = _testcapi.code_newempty("filename", "funcname", 15)
self.assertEqual(co.co_filename, "filename")
self.assertEqual(co.co_name, "funcname")