Skip to content

Commit c7dc0c3

Browse files
alexmalyshevmiss-islington
authored andcommitted
gh-145557: Check ctypes is available in test_external_inspection (GH-145558)
Currently TestGetStackTrace.test_self_trace_after_ctypes_import() will fail if the _ctypes extension is not built. Make it match test_ctypes by skipping the test in that case. (cherry picked from commit 7232883adfc28f94a62d2e79c897db59711702d7) Co-authored-by: Alex Malyshev <lex.malyshev@gmail.com>
1 parent b7fb235 commit c7dc0c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_external_inspection.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
busy_retry,
1515
requires_gil_enabled,
1616
)
17+
from test.support.import_helper import import_module
1718
from test.support.script_helper import make_script
1819
from test.support.socket_helper import find_unused_port
1920

@@ -163,6 +164,10 @@ def test_self_trace_after_ctypes_import(self):
163164
The remote debugging code must skip these uninitialized duplicate
164165
mappings and find the real PyRuntime. See gh-144563.
165166
"""
167+
168+
# Skip the test if the _ctypes module is missing.
169+
import_module("_ctypes")
170+
166171
# Run the test in a subprocess to avoid side effects
167172
script = textwrap.dedent("""\
168173
import os

0 commit comments

Comments
 (0)