MCPcopy Index your code
hub / github.com/python/cpython / test_timeout_connect_ex

Method test_timeout_connect_ex

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

Source from the content-addressed store, hash-verified

2504class NetworkedTests(unittest.TestCase):
2505
2506 def test_timeout_connect_ex(self):
2507 # Issue #12065: on a timeout, connect_ex() should return the original
2508 # errno (mimicking the behaviour of non-SSL sockets).
2509 with socket_helper.transient_internet(REMOTE_HOST):
2510 s = test_wrap_socket(socket.socket(socket.AF_INET),
2511 cert_reqs=ssl.CERT_REQUIRED,
2512 do_handshake_on_connect=False)
2513 self.addCleanup(s.close)
2514 s.settimeout(0.0000001)
2515 rc = s.connect_ex((REMOTE_HOST, 443))
2516 if rc == 0:
2517 self.skipTest("REMOTE_HOST responded too quickly")
2518 elif rc == errno.ENETUNREACH:
2519 self.skipTest("Network unreachable.")
2520 self.assertIn(rc, (errno.EAGAIN, errno.EWOULDBLOCK))
2521
2522 @unittest.skipUnless(socket_helper.IPV6_ENABLED, 'Needs IPv6')
2523 @support.requires_resource('walltime')

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected