[Python-checkins] bpo-43562: fix test_ssl to skip on unreachable network (GH-24937)

miss-islington webhook-mailer at python.org
Sat Mar 27 17:52:37 EDT 2021

commit: 29c451c6989c3c94fa0a9facf187c24f3cbf2420
branch: master
author: Carl Meyer <carl at oddbird.net>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-03-27T14:52:28-07:00

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.

M Lib/test/test_ssl.py

diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index bed0d413a80b3..fa77406bca82a 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2301,6 +2301,8 @@ def test_timeout_connect_ex(self):
             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')

More information about the Python-checkins mailing list