From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:37:32 +0000 (-0700) Subject: bpo-43562: fix test_ssl to skip on unreachable network (GH-24937) (GH-25046) X-Git-Tag: v3.9.3~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=acb584958e215aff8fc8f5e2eb3fef481b662f69;p=thirdparty%2FPython%2Fcpython.git 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 Co-authored-by: Carl Meyer --- diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 738929e3195b..ae9a0b2efc98 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2276,6 +2276,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')