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

Method test_connect_ex_error

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

Source from the content-addressed store, hash-verified

964 self.cert_time_fail(local_february_name() + " 9 00:00:00 2007 GMT")
965
966 def test_connect_ex_error(self):
967 server = socket.socket(socket.AF_INET)
968 self.addCleanup(server.close)
969 port = socket_helper.bind_port(server) # Reserve port but don't listen
970 s = test_wrap_socket(socket.socket(socket.AF_INET),
971 cert_reqs=ssl.CERT_REQUIRED)
972 self.addCleanup(s.close)
973 rc = s.connect_ex((HOST, port))
974 # Issue #19919: Windows machines or VMs hosted on Windows
975 # machines sometimes return EWOULDBLOCK.
976 errors = (
977 errno.ECONNREFUSED, errno.EHOSTUNREACH, errno.ETIMEDOUT,
978 errno.EWOULDBLOCK,
979 )
980 self.assertIn(rc, errors)
981
982 def test_read_write_zero(self):
983 # empty reads and writes now work, bpo-42854, bpo-31711

Callers

nothing calls this directly

Calls 5

test_wrap_socketFunction · 0.85
socketMethod · 0.80
addCleanupMethod · 0.80
connect_exMethod · 0.80
assertInMethod · 0.80

Tested by

no test coverage detected