From: Antoine Pitrou Date: Sun, 30 Oct 2011 20:31:34 +0000 (+0100) Subject: Remove unstable SSL tests in the absence of ssl.OP_NO_{SSLv2,SSLv3,TLSv1} X-Git-Tag: v2.7.3rc1~354 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6361ea2b07f126a4f4ee44196e0b1368324d6165;p=python Remove unstable SSL tests in the absence of ssl.OP_NO_{SSLv2,SSLv3,TLSv1} --- diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 0eb508deb3..ba1d868ccc 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -983,6 +983,8 @@ else: """Connecting to an SSLv2 server with various client options""" if test_support.verbose: sys.stdout.write("\n") + if not hasattr(ssl, 'PROTOCOL_SSLv2'): + self.skipTest("PROTOCOL_SSLv2 needed") try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True) try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL) try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED) @@ -995,14 +997,6 @@ else: """Connecting to an SSLv23 server with various client options""" if test_support.verbose: sys.stdout.write("\n") - try: - try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True) - except (ssl.SSLError, socket.error), x: - # this fails on some older versions of OpenSSL (0.9.7l, for instance) - if test_support.verbose: - sys.stdout.write( - " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n" - % str(x)) try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True) try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True) try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True) @@ -1025,8 +1019,6 @@ else: try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED) if hasattr(ssl, 'PROTOCOL_SSLv2'): try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False) - try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_SSLv3) try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False) @skip_if_broken_ubuntu_ssl @@ -1040,8 +1032,6 @@ else: if hasattr(ssl, 'PROTOCOL_SSLv2'): try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False) try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False) - try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False, - client_options=ssl.OP_NO_TLSv1) def test_starttls(self): """Switching from clear text to encrypted and back again."""