Skip to content

Commit 56b2cf5

Browse files
committed
Issue python#28484: Skip tests if GIL is not used or multithreading is disabled
1 parent 10f29c9 commit 56b2cf5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Lib/test/test_capi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ def test_api_misuse(self):
630630
regex = regex.format(ptr=self.PTR_REGEX)
631631
self.assertRegex(out, regex)
632632

633+
@unittest.skipUnless(threading, 'Test requires a GIL (multithreading)')
633634
def check_malloc_without_gil(self, code):
634635
out = self.check(code)
635636
expected = ('Fatal Python error: Python memory allocator called '

Lib/test/test_regrtest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,12 @@ def test_slow_interrupted(self):
696696
code = TEST_INTERRUPTED
697697
test = self.create_test("sigint", code=code)
698698

699-
for multiprocessing in (False, True):
699+
try:
700+
import threading
701+
tests = (False, True)
702+
except ImportError:
703+
tests = (False,)
704+
for multiprocessing in tests:
700705
if multiprocessing:
701706
args = ("--slowest", "-j2", test)
702707
else:

0 commit comments

Comments
 (0)