bpo-43562: fix test_ssl to skip on unreachable network (GH-24937)

This test checks result code of the connection directly, so it never raises an exception that can be suppressed by `support.transient_internet`. Directly support skipping the test in case of unreachable network.
This commit is contained in:
Carl Meyer 2021-03-27 15:52:28 -06:00 committed by GitHub
parent a53e9a7cf5
commit 29c451c698
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2301,6 +2301,8 @@ class NetworkedTests(unittest.TestCase):
rc = s.connect_ex((REMOTE_HOST, 443))
if rc == 0:
self.skipTest("REMOTE_HOST responded too quickly")
elif rc == errno.ENETUNREACH:
self.skipTest("Network unreachable.")
self.assertIn(rc, (errno.EAGAIN, errno.EWOULDBLOCK))
@unittest.skipUnless(socket_helper.IPV6_ENABLED, 'Needs IPv6')