#17249: check for the availability of the thread module.
authorEzio Melotti <ezio.melotti@gmail.com>
Sat, 23 Feb 2013 04:33:51 +0000 (06:33 +0200)
committerEzio Melotti <ezio.melotti@gmail.com>
Sat, 23 Feb 2013 04:33:51 +0000 (06:33 +0200)
Lib/test/test_capi.py

index daeae393cac68b7267d460c0f147a81f8bc613d8..0edb3bf4836c12d4c821bb6117e76f37da6ed51c 100644 (file)
@@ -4,13 +4,14 @@
 from __future__ import with_statement
 import sys
 import time
-import thread
 import random
 import unittest
 from test import test_support
 try:
+    import thread
     import threading
 except ImportError:
+    thread = None
     threading = None
 import _testcapi
 
@@ -97,7 +98,7 @@ class TestPendingCalls(unittest.TestCase):
         self.pendingcalls_wait(l, n)
 
 
-@unittest.skipUnless(threading, 'Threading required for this test.')
+@unittest.skipUnless(threading and thread, 'Threading required for this test.')
 class TestThreadState(unittest.TestCase):
 
     @test_support.reap_threads