From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:02:47 +0000 (+0100) Subject: [3.11] gh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it... X-Git-Tag: v3.11.9~190 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4077f1445cd4d8a4ac2b5bb00d6f470268e85399;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL (GH-101419) (GH-115586) (cherry picked from commit 9fd420f53d1b1087d2ae648b0efc44107d27d867) Co-authored-by: Peter Jiping Xie --- diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 10eee5a37d36..42adc573ecc2 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -45,6 +45,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 @@ -467,6 +468,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, @@ -483,6 +485,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)