MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_timeout_connect_ex

Method test_timeout_connect_ex

Lib/test/test_ssl.py:2227–2241  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2225class NetworkedTests(unittest.TestCase):
2226
2227 def test_timeout_connect_ex(self):
2228 # Issue #12065: on a timeout, connect_ex() should return the original
2229 # errno (mimicking the behaviour of non-SSL sockets).
2230 with socket_helper.transient_internet(REMOTE_HOST):
2231 s = test_wrap_socket(socket.socket(socket.AF_INET),
2232 cert_reqs=ssl.CERT_REQUIRED,
2233 do_handshake_on_connect=False)
2234 self.addCleanup(s.close)
2235 s.settimeout(0.0000001)
2236 rc = s.connect_ex((REMOTE_HOST, 443))
2237 if rc == 0:
2238 self.skipTest("REMOTE_HOST responded too quickly")
2239 elif rc == errno.ENETUNREACH:
2240 self.skipTest("Network unreachable.")
2241 self.assertIn(rc, (errno.EAGAIN, errno.EWOULDBLOCK))
2242
2243 @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'Needs IPv6')
2244 @support.requires_resource('walltime')

Callers

nothing calls this directly

Calls 7

test_wrap_socketFunction · 0.85
socketMethod · 0.80
addCleanupMethod · 0.80
skipTestMethod · 0.80
assertInMethod · 0.80
settimeoutMethod · 0.45
connect_exMethod · 0.45

Tested by

no test coverage detected