Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,23 @@ def setUp(self):
else:
raise
self.serv.listen()
self.serverExplicitReady()
self.serv.settimeout(support.LOOPBACK_TIMEOUT)
# gh-158883: The local CID can be known even if no transport is able
# to deliver a connection to it. Check that before the client thread
# is released: once it is, a failing connect() leaves accept() below
# waiting for the timeout.
with socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) as probe:
probe.settimeout(support.LOOPBACK_TIMEOUT)
try:
probe.connect((cid, VSOCKPORT))
except OSError as exc:
if exc.errno == errno.ENODEV:
self.skipTest(f"connect() failed with {exc!r}")
else:
raise
conn, _ = self.serv.accept()
conn.close()
self.serverExplicitReady()
self.conn, self.connaddr = self.serv.accept()
self.addCleanup(self.conn.close)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Skip ``test_socket.ThreadedVSOCKSocketStreamTest`` when connecting to the
local ``AF_VSOCK`` address fails with :data:`~errno.ENODEV`, instead of
failing with a timeout.
Loading