diff options
author | Petr Viktorin <encukou@gmail.com> | 2018-05-16 15:51:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 15:51:18 (GMT) |
commit | 8b94b41ab7b12f745dea744e8940631318816935 (patch) | |
tree | 7712623c850aa5988a7024effe3ae3ce6777eaa8 /Lib/test/test_ssl.py | |
parent | 93f9a8a5afb58b1d2e4f27bb46d3d4e0fa8c08f0 (diff) | |
download | cpython-8b94b41ab7b12f745dea744e8940631318816935.zip cpython-8b94b41ab7b12f745dea744e8940631318816935.tar.gz cpython-8b94b41ab7b12f745dea744e8940631318816935.tar.bz2 |
bpo-28167: Remove platform.linux_distribution (GH-6871)
* test_ssl: Remove skip_if_broken_ubuntu_ssl
We no longer support OpenSSL 0.9.8.15.15.
* bpo-28167: Remove platform.linux_distribution
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r-- | Lib/test/test_ssl.py | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 36580d5..7138079 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -181,22 +181,6 @@ def asn1time(cert_time): return cert_time -# Issue #9415: Ubuntu hijacks their OpenSSL and forcefully disables SSLv2 -def skip_if_broken_ubuntu_ssl(func): - if hasattr(ssl, 'PROTOCOL_SSLv2'): - @functools.wraps(func) - def f(*args, **kwargs): - try: - ssl.SSLContext(ssl.PROTOCOL_SSLv2) - except ssl.SSLError: - if (ssl.OPENSSL_VERSION_INFO == (0, 9, 8, 15, 15) and - platform.linux_distribution() == ('debian', 'squeeze/sid', '')): - raise unittest.SkipTest("Patched Ubuntu OpenSSL breaks behaviour") - return func(*args, **kwargs) - return f - else: - return func - needs_sni = unittest.skipUnless(ssl.HAS_SNI, "SNI support needed for this test") @@ -975,7 +959,6 @@ class BasicSocketTests(unittest.TestCase): class ContextTests(unittest.TestCase): - @skip_if_broken_ubuntu_ssl def test_constructor(self): for protocol in PROTOCOLS: ssl.SSLContext(protocol) @@ -984,7 +967,6 @@ class ContextTests(unittest.TestCase): self.assertRaises(ValueError, ssl.SSLContext, -1) self.assertRaises(ValueError, ssl.SSLContext, 42) - @skip_if_broken_ubuntu_ssl def test_protocol(self): for proto in PROTOCOLS: ctx = ssl.SSLContext(proto) @@ -1018,7 +1000,6 @@ class ContextTests(unittest.TestCase): self.assertIn('AES256-GCM-SHA384', names) self.assertIn('AES128-GCM-SHA256', names) - @skip_if_broken_ubuntu_ssl def test_options(self): ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) # OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value @@ -1333,7 +1314,6 @@ class ContextTests(unittest.TestCase): with self.assertRaises(ssl.SSLError) as cm: ctx.load_dh_params(CERTFILE) - @skip_if_broken_ubuntu_ssl def test_session_stats(self): for proto in PROTOCOLS: ctx = ssl.SSLContext(proto) @@ -2554,7 +2534,6 @@ def try_protocol_combo(server_protocol, client_protocol, expect_success, class ThreadedTests(unittest.TestCase): - @skip_if_broken_ubuntu_ssl def test_echo(self): """Basic test of an SSL client connecting to a server""" if support.verbose: @@ -2923,7 +2902,6 @@ class ThreadedTests(unittest.TestCase): self.assertIn(msg, repr(e)) self.assertIn('certificate verify failed', repr(e)) - @skip_if_broken_ubuntu_ssl @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv2'), "OpenSSL is compiled without SSLv2 support") def test_protocol_sslv2(self): @@ -2947,7 +2925,6 @@ class ThreadedTests(unittest.TestCase): try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_TLSv1) - @skip_if_broken_ubuntu_ssl def test_PROTOCOL_TLS(self): """Connecting to an SSLv23 server with various client options""" if support.verbose: @@ -2987,7 +2964,6 @@ class ThreadedTests(unittest.TestCase): server_options=ssl.OP_NO_TLSv1) - @skip_if_broken_ubuntu_ssl @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv3'), "OpenSSL is compiled without SSLv3 support") def test_protocol_sslv3(self): @@ -3007,7 +2983,6 @@ class ThreadedTests(unittest.TestCase): try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_SSLv2) - @skip_if_broken_ubuntu_ssl def test_protocol_tlsv1(self): """Connecting to a TLSv1 server with various client options""" if support.verbose: @@ -3022,7 +2997,6 @@ class ThreadedTests(unittest.TestCase): try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLS, False, client_options=ssl.OP_NO_TLSv1) - @skip_if_broken_ubuntu_ssl @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_1"), "TLS version 1.1 not supported.") def test_protocol_tlsv1_1(self): @@ -3042,7 +3016,6 @@ class ThreadedTests(unittest.TestCase): try_protocol_combo(ssl.PROTOCOL_TLSv1_1, ssl.PROTOCOL_TLSv1, False) try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1_1, False) - @skip_if_broken_ubuntu_ssl @unittest.skipUnless(hasattr(ssl, "PROTOCOL_TLSv1_2"), "TLS version 1.2 not supported.") def test_protocol_tlsv1_2(self): @@ -4087,24 +4060,16 @@ def test_main(verbose=False): if support.verbose: import warnings plats = { - 'Linux': platform.linux_distribution, 'Mac': platform.mac_ver, 'Windows': platform.win32_ver, } - with warnings.catch_warnings(): - warnings.filterwarnings( - 'ignore', - r'dist\(\) and linux_distribution\(\) ' - 'functions are deprecated .*', - PendingDeprecationWarning, - ) - for name, func in plats.items(): - plat = func() - if plat and plat[0]: - plat = '%s %r' % (name, plat) - break - else: - plat = repr(platform.platform()) + for name, func in plats.items(): + plat = func() + if plat and plat[0]: + plat = '%s %r' % (name, plat) + break + else: + plat = repr(platform.platform()) print("test_ssl: testing with %r %r" % (ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO)) print(" under %s" % plat) |