Issue #7449, last part (11): fix many tests if thread support is disabled
* Use try/except ImportError or test_support.import_module() to import thread
and threading modules
* Add @unittest.skipUnless(threading, ...) to testcases using threads
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 4f0dd3e..a478bd4 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -9,12 +9,15 @@
import signal
import socket
import tempfile
-import threading
import unittest
import SocketServer
import test.test_support
from test.test_support import reap_children, reap_threads, verbose
+try:
+ import threading
+except ImportError:
+ threading = None
test.test_support.requires("network")
@@ -119,6 +122,7 @@
self.assertEquals(server.server_address, server.socket.getsockname())
return server
+ @unittest.skipUnless(threading, 'Threading required for this test.')
@reap_threads
def run_server(self, svrcls, hdlrbase, testfunc):
server = self.make_server(self.pickaddr(svrcls.address_family),