Skip to content

Commit 7232883

Browse files
authored
gh-145557: Check ctypes is available in test_external_inspection (#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.
1 parent e094544 commit 7232883

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
@@ -17,6 +17,7 @@
1717
requires_gil_enabled,
1818
requires_remote_subprocess_debugging,
1919
)
20+
from test.support.import_helper import import_module
2021
from test.support.script_helper import make_script
2122
from test.support.socket_helper import find_unused_port
2223

@@ -529,6 +530,10 @@ def test_self_trace_after_ctypes_import(self):
529530
The remote debugging code must skip these uninitialized duplicate
530531
mappings and find the real PyRuntime. See gh-144563.
531532
"""
533+
534+
# Skip the test if the _ctypes module is missing.
535+
import_module("_ctypes")
536+
532537
# Run the test in a subprocess to avoid side effects
533538
script = textwrap.dedent("""\
534539
import os

0 commit comments

Comments
 (0)