]> granicus.if.org Git - python/commitdiff
#17249: check for the availability of the thread module.
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 23 Feb 2013 04:42:19 +0000 (06:42 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 23 Feb 2013 04:42:19 +0000 (06:42 +0200)
Lib/test/test_capi.py

index d61bf363dc3126d3e2ca643f1400002c9afee7a1..0ab145807e14387cd8a7aa53bd7f53be9bc1ba60 100644 (file)
@@ -8,7 +8,6 @@ import random
 import subprocess
 import sys
 import time
-import _thread
 import unittest
 from test import support
 try:
@@ -16,8 +15,10 @@ try:
 except ImportError:
     _posixsubprocess = None
 try:
+    import _thread
     import threading
 except ImportError:
+    _thread = None
     threading = None
 import _testcapi
 
@@ -223,7 +224,7 @@ class EmbeddingTest(unittest.TestCase):
             os.chdir(oldcwd)
 
 
-@unittest.skipUnless(threading, 'Threading required for this test.')
+@unittest.skipUnless(threading and _thread, 'Threading required for this test.')
 class TestThreadState(unittest.TestCase):
 
     @support.reap_threads