]> granicus.if.org Git - python/commitdiff
Issue #28484: Skip tests if GIL is not used or multithreading is disabled
authorMartin Panter <vadmium+py@gmail.com>
Thu, 20 Oct 2016 21:45:49 +0000 (21:45 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Thu, 20 Oct 2016 21:45:49 +0000 (21:45 +0000)
Lib/test/test_capi.py
Lib/test/test_regrtest.py

index 5521e761121ff13791915597eee023e6bba08491..d4faeb375e46105323b164e7915cf334f1ef5320 100644 (file)
@@ -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 '
index d43160470f222312571d0c19c88b93988b3ab967..52909d833e7d9080424d51705eb19a780ca185a3 100644 (file)
@@ -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: