]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43562: fix test_ssl to skip on unreachable network (GH-24937)
authorCarl Meyer <carl@oddbird.net>
Sat, 27 Mar 2021 21:52:28 +0000 (15:52 -0600)
committerGitHub <noreply@github.com>
Sat, 27 Mar 2021 21:52:28 +0000 (14:52 -0700)
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.

Lib/test/test_ssl.py

index bed0d413a80b3689b086546bc92eaf353e2b9ff5..fa77406bca82a1d9d99c233afdc05afc2fd411b8 100644 (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')