gh-116303: Skip test module dependent tests if test modules are unavailable (#117341)

This commit is contained in:
Erlend E. Aasland 2024-04-03 15:11:36 +02:00 committed by GitHub
parent 2ec6bb4111
commit ea94b3b149
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 255 additions and 123 deletions

View file

@ -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