From: Antoine Pitrou Date: Sun, 31 Oct 2010 13:26:53 +0000 (+0000) Subject: Don't fail in test_ssl when svn.python.org is unavailable X-Git-Tag: v2.7.1rc1~85 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=942d554c5b4b182c60f63c0ad18974a3870e9fc8;p=python Don't fail in test_ssl when svn.python.org is unavailable --- diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 37261554bc..4c12ce47d4 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -156,18 +156,19 @@ class BasicSocketTests(unittest.TestCase): if not test_support.is_resource_enabled('network'): return remote = ("svn.python.org", 443) - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_NONE, ciphers="ALL") - s.connect(remote) - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_NONE, ciphers="DEFAULT") - s.connect(remote) - # Error checking occurs when connecting, because the SSL context - # isn't created before. - s = ssl.wrap_socket(socket.socket(socket.AF_INET), - cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx") - with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"): + with test_support.transient_internet(remote[0]): + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_NONE, ciphers="ALL") + s.connect(remote) + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_NONE, ciphers="DEFAULT") s.connect(remote) + # Error checking occurs when connecting, because the SSL context + # isn't created before. + s = ssl.wrap_socket(socket.socket(socket.AF_INET), + cert_reqs=ssl.CERT_NONE, ciphers="^$:,;?*'dorothyx") + with self.assertRaisesRegexp(ssl.SSLError, "No cipher can be selected"): + s.connect(remote) @test_support.cpython_only def test_refcycle(self):