From: Martin Panter Date: Thu, 20 Oct 2016 21:45:49 +0000 (+0000) Subject: Issue #28484: Skip tests if GIL is not used or multithreading is disabled X-Git-Tag: v3.6.0b3~90 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56b2cf5e8564c7221a42675d35aaa0d0c503365e;p=thirdparty%2FPython%2Fcpython.git Issue #28484: Skip tests if GIL is not used or multithreading is disabled --- diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 5521e761121f..d4faeb375e46 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -630,6 +630,7 @@ class PyMemDebugTests(unittest.TestCase): regex = regex.format(ptr=self.PTR_REGEX) self.assertRegex(out, regex) + @unittest.skipUnless(threading, 'Test requires a GIL (multithreading)') def check_malloc_without_gil(self, code): out = self.check(code) expected = ('Fatal Python error: Python memory allocator called ' diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index d43160470f22..52909d833e7d 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -696,7 +696,12 @@ class ArgsTestCase(BaseTestCase): 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: