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

Method test_connect_fail

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

Source from the content-addressed store, hash-verified

2084 self.assertFalse(s.server_side)
2085
2086 def test_connect_fail(self):
2087 # This should fail because we have no verification certs. Connection
2088 # failure crashes ThreadedEchoServer, so run this in an independent
2089 # test method.
2090 s = test_wrap_socket(socket.socket(socket.AF_INET),
2091 cert_reqs=ssl.CERT_REQUIRED)
2092 self.addCleanup(s.close)
2093 # Allow for flexible libssl error messages.
2094 regex = re.compile(r"""(
2095 certificate verify failed # OpenSSL
2096 |
2097 CERTIFICATE_VERIFY_FAILED # AWS-LC
2098 )""", re.X)
2099 self.assertRaisesRegex(ssl.SSLError, regex,
2100 s.connect, self.server_addr)
2101
2102 def test_connect_ex(self):
2103 # Issue #11326: check connect_ex() implementation

Callers

nothing calls this directly

Calls 5

test_wrap_socketFunction · 0.85
socketMethod · 0.80
addCleanupMethod · 0.80
assertRaisesRegexMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected