[Python-checkins] cpython (3.6): Issue #28484: Skip tests if GIL is not used or multithreading is disabled

martin.panter python-checkins at python.org
Thu Oct 20 19:08:58 EDT 2016


https://hg.python.org/cpython/rev/b811ec148337
changeset:   104595:b811ec148337
branch:      3.6
user:        Martin Panter <vadmium+py at gmail.com>
date:        Thu Oct 20 21:45:49 2016 +0000
summary:
  Issue #28484: Skip tests if GIL is not used or multithreading is disabled

files:
  Lib/test/test_capi.py     |  1 +
  Lib/test/test_regrtest.py |  7 ++++++-
  2 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -630,6 +630,7 @@
         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
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -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:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list