]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL...
authorPeter Jiping Xie <peter.jp.xie@gmail.com>
Sat, 17 Feb 2024 09:12:12 +0000 (20:12 +1100)
committerGitHub <noreply@github.com>
Sat, 17 Feb 2024 09:12:12 +0000 (09:12 +0000)
Lib/test/test_socket.py

index 1796423499206271beba397e9369412b35cacf44..b936e9ae91daca0ae72f11131b9d21b656ca9a46 100644 (file)
@@ -46,6 +46,7 @@ MSG = 'Michael Gilfix was here\u1234\r\n'.encode('utf-8')
 
 VSOCKPORT = 1234
 AIX = platform.system() == "AIX"
+WSL = "microsoft-standard-WSL" in platform.release()
 
 try:
     import _socket
@@ -510,6 +511,7 @@ class ThreadedRDSSocketTest(SocketRDSTest, ThreadableTest):
         ThreadableTest.clientTearDown(self)
 
 @unittest.skipIf(fcntl is None, "need fcntl")
+@unittest.skipIf(WSL, 'VSOCK does not work on Microsoft WSL')
 @unittest.skipUnless(HAVE_SOCKET_VSOCK,
           'VSOCK sockets required for this test.')
 @unittest.skipUnless(get_cid() != 2,
@@ -526,6 +528,7 @@ class ThreadedVSOCKSocketStreamTest(unittest.TestCase, ThreadableTest):
         self.serv.bind((socket.VMADDR_CID_ANY, VSOCKPORT))
         self.serv.listen()
         self.serverExplicitReady()
+        self.serv.settimeout(support.LOOPBACK_TIMEOUT)
         self.conn, self.connaddr = self.serv.accept()
         self.addCleanup(self.conn.close)