# HG changeset patch # Parent 948cf38793ce6365210f8a78fad044a0b1e73a8d Skip tests if GIL is not used or multithreading is disabled diff -r 948cf38793ce Lib/test/test_capi.py --- a/Lib/test/test_capi.py Thu Oct 20 05:25:14 2016 +0000 +++ b/Lib/test/test_capi.py Thu Oct 20 07:15:17 2016 +0000 @@ -631,6 +631,8 @@ self.assertRegex(out, regex) def check_malloc_without_gil(self, code): + if not threading: + self.skipTest('Test requires a GIL (multithreading)') out = self.check(code) expected = ('Fatal Python error: Python memory allocator called ' 'without holding the GIL') diff -r 948cf38793ce Lib/test/test_regrtest.py --- a/Lib/test/test_regrtest.py Thu Oct 20 05:25:14 2016 +0000 +++ b/Lib/test/test_regrtest.py Thu Oct 20 07:15:17 2016 +0000 @@ -696,7 +696,12 @@ code = TEST_INTERRUPTED test = self.create_test("sigint", code=code) - for multiprocessing in (False, True): + try: + import threading + tests = (False, True) + except ImportError: + tests = (False,) + for multiprocessing in tests: if multiprocessing: args = ("--slowest", "-j2", test) else: