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

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


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

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

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 3d995db6d1ea1..ec7bb74d28ce6 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2271,6 +2271,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(support.IPV6_ENABLED, 'Needs IPv6')



More information about the Python-checkins mailing list