]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43562: fix test_ssl to skip on unreachable network (GH-24937) (GH-25047)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 29 Mar 2021 19:37:38 +0000 (12:37 -0700)
committerGitHub <noreply@github.com>
Mon, 29 Mar 2021 19:37:38 +0000 (21:37 +0200)
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@oddbird.net>
Co-authored-by: Carl Meyer <carl@oddbird.net>
Lib/test/test_ssl.py

index 3d995db6d1ea1aab75cf1dbc517d8a34fce9fcd4..ec7bb74d28ce6f25036517a3d62da0208b7c617c 100644 (file)
@@ -2271,6 +2271,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(support.IPV6_ENABLED, 'Needs IPv6')