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

vstinner webhook-mailer at python.org
Mon Mar 29 15:37:41 EDT 2021


https://github.com/python/cpython/commit/acb584958e215aff8fc8f5e2eb3fef481b662f69
commit: acb584958e215aff8fc8f5e2eb3fef481b662f69
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: vstinner <vstinner at python.org>
date: 2021-03-29T21:37:32+02:00
summary:

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

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.
(cherry picked from commit 29c451c6989c3c94fa0a9facf187c24f3cbf2420)

Co-authored-by: Carl Meyer <carl at oddbird.net>

Co-authored-by: Carl Meyer <carl at oddbird.net>

files:
M Lib/test/test_ssl.py

diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 738929e3195bc..ae9a0b2efc985 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2276,6 +2276,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