# HG changeset patch # Parent 86a1f92c66b33530e2401f0cc82273e464c402ce diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -64,7 +64,7 @@ # Size in bytes of the int type SIZEOF_INT = array.array("i").itemsize -class SocketTCPTest(unittest.TestCase): +class SocketTCPTest: def setUp(self): self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -75,7 +75,7 @@ self.serv.close() self.serv = None -class SocketUDPTest(unittest.TestCase): +class SocketUDPTest: def setUp(self): self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) @@ -85,7 +85,7 @@ self.serv.close() self.serv = None -class ThreadSafeCleanupTestCase(unittest.TestCase): +class ThreadSafeCleanupTestCase: """Subclass of unittest.TestCase with thread-safe cleanup methods. This subclass protects the addCleanup() and doCleanups() methods @@ -105,7 +105,7 @@ with self._cleanup_lock: return super().doCleanups(*args, **kwargs) -class SocketCANTest(unittest.TestCase): +class SocketCANTest: """To be able to run this test, a `vcan0` CAN interface can be created with the following commands: @@ -126,7 +126,7 @@ self.interface) -class SocketRDSTest(unittest.TestCase): +class SocketRDSTest: """To be able to run this test, the `rds` kernel module must be loaded: # modprobe rds @@ -180,7 +180,8 @@ connection and performing the accept() in setUp(). """ - def __init__(self): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) # Swap the true setup function self.__setUp = self.setUp self.__tearDown = self.tearDown @@ -254,10 +255,6 @@ class ThreadedTCPSocketTest(SocketTCPTest, ThreadableTest): - def __init__(self, methodName='runTest'): - SocketTCPTest.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) - def clientSetUp(self): self.cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -268,10 +265,6 @@ class ThreadedUDPSocketTest(SocketUDPTest, ThreadableTest): - def __init__(self, methodName='runTest'): - SocketUDPTest.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) - def clientSetUp(self): self.cli = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) @@ -282,10 +275,6 @@ class ThreadedCANSocketTest(SocketCANTest, ThreadableTest): - def __init__(self, methodName='runTest'): - SocketCANTest.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) - def clientSetUp(self): self.cli = socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW) try: @@ -302,10 +291,6 @@ class ThreadedRDSSocketTest(SocketRDSTest, ThreadableTest): - def __init__(self, methodName='runTest'): - SocketRDSTest.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) - def clientSetUp(self): self.cli = socket.socket(socket.PF_RDS, socket.SOCK_SEQPACKET, 0) try: @@ -329,9 +314,6 @@ setUp() method guarantees that it is connected to the server. """ - def __init__(self, methodName='runTest'): - ThreadedTCPSocketTest.__init__(self, methodName=methodName) - def setUp(self): ThreadedTCPSocketTest.setUp(self) # Indicate explicitly we're ready for the client thread to @@ -355,11 +337,7 @@ self.serv_conn = None ThreadedTCPSocketTest.clientTearDown(self) -class SocketPairTest(unittest.TestCase, ThreadableTest): - - def __init__(self, methodName='runTest'): - unittest.TestCase.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) +class SocketPairTest(ThreadableTest): def setUp(self): self.serv, self.cli = socket.socketpair() @@ -383,7 +361,7 @@ # address families can be used, and the attributes serv_addr and # cli_addr will be set to the addresses of the endpoints. -class SocketTestBase(unittest.TestCase): +class SocketTestBase: """A base class for socket tests. Subclasses must provide methods newSocket() to return a new socket @@ -422,10 +400,6 @@ ThreadableTest for usage information. """ - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - ThreadableTest.__init__(self) - def clientSetUp(self): self.cli = self.newClientSocket() self.bindClient() @@ -1306,7 +1280,7 @@ @unittest.skipUnless(HAVE_SOCKET_CAN, 'SocketCan required for this test.') @unittest.skipUnless(thread, 'Threading required for this test.') -class CANTest(ThreadedCANSocketTest): +class CANTest(ThreadedCANSocketTest, unittest.TestCase): """The CAN frame structure is defined in : @@ -1318,9 +1292,6 @@ """ can_frame_fmt = "=IB3x8s" - def __init__(self, methodName='runTest'): - ThreadedCANSocketTest.__init__(self, methodName=methodName) - @classmethod def build_can_frame(cls, can_id, data): """Build a CAN frame.""" @@ -1387,10 +1358,7 @@ @unittest.skipUnless(HAVE_SOCKET_RDS, 'RDS sockets required for this test.') @unittest.skipUnless(thread, 'Threading required for this test.') -class RDSTest(ThreadedRDSSocketTest): - - def __init__(self, methodName='runTest'): - ThreadedRDSSocketTest.__init__(self, methodName=methodName) +class RDSTest(ThreadedRDSSocketTest, unittest.TestCase): def setUp(self): super().setUp() @@ -1478,10 +1446,7 @@ @unittest.skipUnless(thread, 'Threading required for this test.') -class BasicTCPTest(SocketConnectedTest): - - def __init__(self, methodName='runTest'): - SocketConnectedTest.__init__(self, methodName=methodName) +class BasicTCPTest(SocketConnectedTest, unittest.TestCase): def testRecv(self): # Testing large receive over TCP @@ -1587,10 +1552,7 @@ self.serv_conn.send(MSG) @unittest.skipUnless(thread, 'Threading required for this test.') -class BasicUDPTest(ThreadedUDPSocketTest): - - def __init__(self, methodName='runTest'): - ThreadedUDPSocketTest.__init__(self, methodName=methodName) +class BasicUDPTest(ThreadedUDPSocketTest, unittest.TestCase): def testSendtoAndRecv(self): # Testing sendto() and Recv() over UDP @@ -3176,17 +3138,19 @@ @requireAttrs(socket.socket, "sendmsg") @unittest.skipUnless(thread, 'Threading required for this test.') -class SendmsgUDPTest(SendmsgConnectionlessTests, SendrecvmsgUDPTestBase): +class SendmsgUDPTest(SendmsgConnectionlessTests, SendrecvmsgUDPTestBase, + unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg") @unittest.skipUnless(thread, 'Threading required for this test.') -class RecvmsgUDPTest(RecvmsgTests, SendrecvmsgUDPTestBase): +class RecvmsgUDPTest(RecvmsgTests, SendrecvmsgUDPTestBase, unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg_into") @unittest.skipUnless(thread, 'Threading required for this test.') -class RecvmsgIntoUDPTest(RecvmsgIntoTests, SendrecvmsgUDPTestBase): +class RecvmsgIntoUDPTest(RecvmsgIntoTests, SendrecvmsgUDPTestBase, + unittest.TestCase): pass @@ -3199,21 +3163,22 @@ @unittest.skipUnless(socket.has_ipv6, "Python not built with IPv6 support") @requireSocket("AF_INET6", "SOCK_DGRAM") @unittest.skipUnless(thread, 'Threading required for this test.') -class SendmsgUDP6Test(SendmsgConnectionlessTests, SendrecvmsgUDP6TestBase): +class SendmsgUDP6Test(SendmsgConnectionlessTests, SendrecvmsgUDP6TestBase, unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg") @unittest.skipUnless(socket.has_ipv6, "Python not built with IPv6 support") @requireSocket("AF_INET6", "SOCK_DGRAM") @unittest.skipUnless(thread, 'Threading required for this test.') -class RecvmsgUDP6Test(RecvmsgTests, SendrecvmsgUDP6TestBase): +class RecvmsgUDP6Test(RecvmsgTests, SendrecvmsgUDP6TestBase, unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg_into") @unittest.skipUnless(socket.has_ipv6, "Python not built with IPv6 support") @requireSocket("AF_INET6", "SOCK_DGRAM") @unittest.skipUnless(thread, 'Threading required for this test.') -class RecvmsgIntoUDP6Test(RecvmsgIntoTests, SendrecvmsgUDP6TestBase): +class RecvmsgIntoUDP6Test(RecvmsgIntoTests, SendrecvmsgUDP6TestBase, + unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg") @@ -3222,7 +3187,8 @@ @requireSocket("AF_INET6", "SOCK_DGRAM") @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgRFC3542AncillaryUDP6Test(RFC3542AncillaryTest, - SendrecvmsgUDP6TestBase): + SendrecvmsgUDP6TestBase, + unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg_into") @@ -3232,7 +3198,8 @@ @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoRFC3542AncillaryUDP6Test(RecvmsgIntoMixin, RFC3542AncillaryTest, - SendrecvmsgUDP6TestBase): + SendrecvmsgUDP6TestBase, + unittest.TestCase): pass @@ -3242,19 +3209,20 @@ @requireAttrs(socket.socket, "sendmsg") @unittest.skipUnless(thread, 'Threading required for this test.') -class SendmsgTCPTest(SendmsgStreamTests, SendrecvmsgTCPTestBase): +class SendmsgTCPTest(SendmsgStreamTests, SendrecvmsgTCPTestBase, + unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg") @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgTCPTest(RecvmsgTests, RecvmsgGenericStreamTests, - SendrecvmsgTCPTestBase): + SendrecvmsgTCPTestBase, unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg_into") @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoTCPTest(RecvmsgIntoTests, RecvmsgGenericStreamTests, - SendrecvmsgTCPTestBase): + SendrecvmsgTCPTestBase, unittest.TestCase): pass @@ -3266,21 +3234,22 @@ @requireAttrs(socket.socket, "sendmsg") @requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP") @unittest.skipUnless(thread, 'Threading required for this test.') -class SendmsgSCTPStreamTest(SendmsgStreamTests, SendrecvmsgSCTPStreamTestBase): +class SendmsgSCTPStreamTest(SendmsgStreamTests, SendrecvmsgSCTPStreamTestBase, unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg") @requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP") @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgSCTPStreamTest(RecvmsgTests, RecvmsgGenericStreamTests, - SendrecvmsgSCTPStreamTestBase): + SendrecvmsgSCTPStreamTestBase, unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg_into") @requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP") @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoSCTPStreamTest(RecvmsgIntoTests, RecvmsgGenericStreamTests, - SendrecvmsgSCTPStreamTestBase): + SendrecvmsgSCTPStreamTestBase, + unittest.TestCase): pass @@ -3291,34 +3260,38 @@ @requireAttrs(socket.socket, "sendmsg") @requireAttrs(socket, "AF_UNIX") @unittest.skipUnless(thread, 'Threading required for this test.') -class SendmsgUnixStreamTest(SendmsgStreamTests, SendrecvmsgUnixStreamTestBase): +class SendmsgUnixStreamTest(SendmsgStreamTests, SendrecvmsgUnixStreamTestBase, + unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg") @requireAttrs(socket, "AF_UNIX") @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgUnixStreamTest(RecvmsgTests, RecvmsgGenericStreamTests, - SendrecvmsgUnixStreamTestBase): + SendrecvmsgUnixStreamTestBase, unittest.TestCase): pass @requireAttrs(socket.socket, "recvmsg_into") @requireAttrs(socket, "AF_UNIX") @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoUnixStreamTest(RecvmsgIntoTests, RecvmsgGenericStreamTests, - SendrecvmsgUnixStreamTestBase): + SendrecvmsgUnixStreamTestBase, + unittest.TestCase): pass @requireAttrs(socket.socket, "sendmsg", "recvmsg") @requireAttrs(socket, "AF_UNIX", "SOL_SOCKET", "SCM_RIGHTS") @unittest.skipUnless(thread, 'Threading required for this test.') -class RecvmsgSCMRightsStreamTest(SCMRightsTest, SendrecvmsgUnixStreamTestBase): +class RecvmsgSCMRightsStreamTest(SCMRightsTest, SendrecvmsgUnixStreamTestBase, + unittest.TestCase): pass @requireAttrs(socket.socket, "sendmsg", "recvmsg_into") @requireAttrs(socket, "AF_UNIX", "SOL_SOCKET", "SCM_RIGHTS") @unittest.skipUnless(thread, 'Threading required for this test.') class RecvmsgIntoSCMRightsStreamTest(RecvmsgIntoMixin, SCMRightsTest, - SendrecvmsgUnixStreamTestBase): + SendrecvmsgUnixStreamTestBase, + unittest.TestCase): pass @@ -3327,7 +3300,7 @@ # threads alive during the test so that the OS cannot deliver the # signal to the wrong one. -class InterruptedTimeoutBase(unittest.TestCase): +class InterruptedTimeoutBase: # Base class for interrupted send/receive tests. Installs an # empty handler for SIGALRM and removes it on teardown, along with # any scheduled alarms. @@ -3363,7 +3336,8 @@ @requireAttrs(signal, "siginterrupt") @unittest.skipUnless(hasattr(signal, "alarm") or hasattr(signal, "setitimer"), "Don't have signal.alarm or signal.setitimer") -class InterruptedRecvTimeoutTest(InterruptedTimeoutBase, UDPTestBase): +class InterruptedRecvTimeoutTest(InterruptedTimeoutBase, UDPTestBase, + unittest.TestCase): # Test interrupting the recv*() methods with signals when a # timeout is set. @@ -3409,7 +3383,8 @@ @unittest.skipUnless(thread, 'Threading required for this test.') class InterruptedSendTimeoutTest(InterruptedTimeoutBase, ThreadSafeCleanupTestCase, - SocketListeningTestMixin, TCPTestBase): + SocketListeningTestMixin, TCPTestBase, + unittest.TestCase): # Test interrupting the interruptible send*() methods with signals # when a timeout is set. @@ -3462,7 +3437,7 @@ @unittest.skipUnless(thread, 'Threading required for this test.') -class TCPCloserTest(ThreadedTCPSocketTest): +class TCPCloserTest(ThreadedTCPSocketTest, unittest.TestCase): def testClose(self): conn, addr = self.serv.accept() @@ -3481,11 +3456,9 @@ self.cli.connect((HOST, self.port)) time.sleep(1.0) +@unittest.skipUnless(hasattr(socket, 'socketpair'), 'Test requires socketpair().') @unittest.skipUnless(thread, 'Threading required for this test.') -class BasicSocketPairTest(SocketPairTest): - - def __init__(self, methodName='runTest'): - SocketPairTest.__init__(self, methodName=methodName) +class BasicSocketPairTest(SocketPairTest, unittest.TestCase): def _check_defaults(self, sock): self.assertIsInstance(sock, socket.socket) @@ -3517,10 +3490,7 @@ self.assertEqual(msg, MSG) @unittest.skipUnless(thread, 'Threading required for this test.') -class NonBlockingTCPTests(ThreadedTCPSocketTest): - - def __init__(self, methodName='runTest'): - ThreadedTCPSocketTest.__init__(self, methodName=methodName) +class NonBlockingTCPTests(ThreadedTCPSocketTest, unittest.TestCase): def testSetBlocking(self): # Testing whether set blocking works @@ -3627,7 +3597,7 @@ self.cli.send(MSG) @unittest.skipUnless(thread, 'Threading required for this test.') -class FileObjectClassTestCase(SocketConnectedTest): +class FileObjectClassTestCase(SocketConnectedTest, unittest.TestCase): """Unit tests for the object returned by socket.makefile() self.read_file is the io object returned by makefile() on @@ -3649,9 +3619,6 @@ write_mode = 'wb' write_msg = MSG - def __init__(self, methodName='runTest'): - SocketConnectedTest.__init__(self, methodName=methodName) - def setUp(self): self.evt1, self.evt2, self.serv_finished, self.cli_finished = [ threading.Event() for i in range(4)] @@ -4019,7 +3986,7 @@ bufsize = 2 # Exercise the buffering code -class UnicodeReadFileObjectClassTestCase(FileObjectClassTestCase): +class UnicodeReadFileObjectClassTestCase(FileObjectClassTestCase, unittest.TestCase): """Tests for socket.makefile() in text mode (rather than binary)""" read_mode = 'r' @@ -4029,7 +3996,7 @@ newline = '' -class UnicodeWriteFileObjectClassTestCase(FileObjectClassTestCase): +class UnicodeWriteFileObjectClassTestCase(FileObjectClassTestCase, unittest.TestCase): """Tests for socket.makefile() in text mode (rather than binary)""" read_mode = 'rb' @@ -4039,7 +4006,7 @@ newline = '' -class UnicodeReadWriteFileObjectClassTestCase(FileObjectClassTestCase): +class UnicodeReadWriteFileObjectClassTestCase(FileObjectClassTestCase, unittest.TestCase): """Tests for socket.makefile() in text mode (rather than binary)""" read_mode = 'r' @@ -4103,11 +4070,7 @@ @unittest.skipUnless(thread, 'Threading required for this test.') -class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest): - - def __init__(self, methodName='runTest'): - SocketTCPTest.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) +class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest, unittest.TestCase): def clientSetUp(self): self.source_port = support.find_unused_port() @@ -4172,11 +4135,7 @@ self.assertEqual(self.cli.gettimeout(), 30) @unittest.skipUnless(thread, 'Threading required for this test.') -class NetworkConnectionBehaviourTest(SocketTCPTest, ThreadableTest): - - def __init__(self, methodName='runTest'): - SocketTCPTest.__init__(self, methodName=methodName) - ThreadableTest.__init__(self) +class NetworkConnectionBehaviourTest(SocketTCPTest, ThreadableTest, unittest.TestCase): def clientSetUp(self): pass @@ -4203,7 +4162,7 @@ self.assertRaises(socket.timeout, lambda: sock.recv(5)) -class TCPTimeoutTest(SocketTCPTest): +class TCPTimeoutTest(SocketTCPTest, unittest.TestCase): def testTCPTimeout(self): def raise_timeout(*args, **kwargs): @@ -4260,7 +4219,7 @@ # no alarm can be pending. Safe to restore old handler. signal.signal(signal.SIGALRM, old_alarm) -class UDPTimeoutTest(SocketUDPTest): +class UDPTimeoutTest(SocketUDPTest, unittest.TestCase): def testUDPTimeout(self): def raise_timeout(*args, **kwargs): @@ -4291,6 +4250,7 @@ self.assertTrue(issubclass(socket.gaierror, socket.error)) self.assertTrue(issubclass(socket.timeout, socket.error)) +@unittest.skipUnless(sys.platform == 'linux', 'Test requires Linux.') class TestLinuxAbstractNamespace(unittest.TestCase): UNIX_PATH_MAX = 108 @@ -4326,6 +4286,7 @@ finally: s.close() +@unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'Test requires Unix sockets.') class TestUnixDomain(unittest.TestCase): def setUp(self): @@ -4391,13 +4352,10 @@ self.assertEqual(self.sock.getsockname(), path) @unittest.skipUnless(thread, 'Threading required for this test.') -class BufferIOTest(SocketConnectedTest): +class BufferIOTest(SocketConnectedTest, unittest.TestCase): """ Test the buffer versions of socket.recv() and socket.send(). """ - def __init__(self, methodName='runTest'): - SocketConnectedTest.__init__(self, methodName=methodName) - def testRecvIntoArray(self): buf = bytearray(1024) nbytes = self.cli_conn.recv_into(buf) @@ -4479,7 +4437,11 @@ print("TIPC module is not loaded, please 'sudo modprobe tipc'") return False +tipcAvailable = isTipcAvailable() + +@unittest.skipUnless(tipcAvailable, 'TIPC is not available') class TIPCTest(unittest.TestCase): + def testRDM(self): srv = socket.socket(socket.AF_TIPC, socket.SOCK_RDM) cli = socket.socket(socket.AF_TIPC, socket.SOCK_RDM) @@ -4501,10 +4463,8 @@ self.assertEqual(msg, MSG) -class TIPCThreadableTest(unittest.TestCase, ThreadableTest): - def __init__(self, methodName = 'runTest'): - unittest.TestCase.__init__(self, methodName = methodName) - ThreadableTest.__init__(self) +@unittest.skipUnless(tipcAvailable, 'TIPC is not available') +class TIPCThreadableTest(ThreadableTest, unittest.TestCase): def setUp(self): self.srv = socket.socket(socket.AF_TIPC, socket.SOCK_STREAM) @@ -4541,7 +4501,7 @@ @unittest.skipUnless(thread, 'Threading required for this test.') -class ContextManagersTest(ThreadedTCPSocketTest): +class ContextManagersTest(ThreadedTCPSocketTest, unittest.TestCase): def _testSocketClass(self): # base test @@ -4643,65 +4603,8 @@ def test_main(): - tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest, - TestExceptions, BufferIOTest, BasicTCPTest2, BasicUDPTest, UDPTimeoutTest ] - - tests.extend([ - NonBlockingTCPTests, - FileObjectClassTestCase, - FileObjectInterruptedTestCase, - UnbufferedFileObjectClassTestCase, - LineBufferedFileObjectClassTestCase, - SmallBufferedFileObjectClassTestCase, - UnicodeReadFileObjectClassTestCase, - UnicodeWriteFileObjectClassTestCase, - UnicodeReadWriteFileObjectClassTestCase, - NetworkConnectionNoServer, - NetworkConnectionAttributesTest, - NetworkConnectionBehaviourTest, - ContextManagersTest, - CloexecConstantTest, - NonblockConstantTest - ]) - if hasattr(socket, "socketpair"): - tests.append(BasicSocketPairTest) - if hasattr(socket, "AF_UNIX"): - tests.append(TestUnixDomain) - if sys.platform == 'linux': - tests.append(TestLinuxAbstractNamespace) - if isTipcAvailable(): - tests.append(TIPCTest) - tests.append(TIPCThreadableTest) - tests.extend([BasicCANTest, CANTest]) - tests.extend([BasicRDSTest, RDSTest]) - tests.extend([ - CmsgMacroTests, - SendmsgUDPTest, - RecvmsgUDPTest, - RecvmsgIntoUDPTest, - SendmsgUDP6Test, - RecvmsgUDP6Test, - RecvmsgRFC3542AncillaryUDP6Test, - RecvmsgIntoRFC3542AncillaryUDP6Test, - RecvmsgIntoUDP6Test, - SendmsgTCPTest, - RecvmsgTCPTest, - RecvmsgIntoTCPTest, - SendmsgSCTPStreamTest, - RecvmsgSCTPStreamTest, - RecvmsgIntoSCTPStreamTest, - SendmsgUnixStreamTest, - RecvmsgUnixStreamTest, - RecvmsgIntoUnixStreamTest, - RecvmsgSCMRightsStreamTest, - RecvmsgIntoSCMRightsStreamTest, - # These are slow when setitimer() is not available - InterruptedRecvTimeoutTest, - InterruptedSendTimeoutTest, - ]) - thread_info = support.threading_setup() - support.run_unittest(*tests) + support.run_unittest(unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__])) support.threading_cleanup(*thread_info) if __name__ == "__main__":