summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2024-04-03 13:11:36 (GMT)
committerGitHub <noreply@github.com>2024-04-03 13:11:36 (GMT)
commitea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e (patch)
tree7fc58f8dcd7513427c7ea2ff9d7bad523be1118a /Lib/test/test_threading.py
parent2ec6bb4111d2c03c1cac02b27c74beee7e5a2a05 (diff)
downloadcpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.zip
cpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.tar.gz
cpython-ea94b3b149eeadf33c2f7c46f16dcda0adc7cf4e.tar.bz2
gh-116303: Skip test module dependent tests if test modules are unavailable (#117341)
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 4414d2b..84a9464 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -959,6 +959,7 @@ class ThreadTests(BaseTestCase):
@cpython_only
def test_frame_tstate_tracing(self):
+ _testcapi = import_module("_testcapi")
# Issue #14432: Crash when a generator is created in a C thread that is
# destroyed while the generator is still used. The issue was that a
# generator contains a frame, and the frame kept a reference to the
@@ -986,7 +987,6 @@ class ThreadTests(BaseTestCase):
threading.settrace(noop_trace)
# Create a generator in a C thread which exits after the call
- import _testcapi
_testcapi.call_in_temporary_c_thread(callback)
# Call the generator in a different Python thread, check that the
@@ -1490,6 +1490,7 @@ class SubinterpThreadingTests(BaseTestCase):
@cpython_only
def test_daemon_threads_fatal_error(self):
+ import_module("_testcapi")
subinterp_code = f"""if 1:
import os
import threading
@@ -1516,6 +1517,7 @@ class SubinterpThreadingTests(BaseTestCase):
daemon_allowed=True,
daemon=False,
):
+ import_module("_testinternalcapi")
subinterp_code = textwrap.dedent(f"""
import test.support
import threading