Skip to content

Commit 4d1c254

Browse files
vstinnerlarryhastings
authored andcommitted
bpo-36576: Skip test_ssl and test_asyncio tests failing with OpenSSL 1.1.1 (python#12694)
Some test_ssl and test_asyncio tests were written for OpenSSL 1.0 and TLS 1.0, but fail with OpenSSL 1.1.1 and TLS 1.3. Fixing these requires backporting new ssl flags like ssl.OP_NO_TLSv1_3 or ssl.OP_NO_COMPRESSION, which is inappropriate at this stage in Python 3.5's lifetime. Moreover, it's not really worth it: the code works fine, the problem is just in the tests. This patch disables those problematic tests when Python 3.5 is built using newer versions of OpenSSL.
1 parent 063eba2 commit 4d1c254

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Lib/test/test_asyncio/test_events.py

+7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
from asyncio import test_support as support
3939

4040

41+
if ssl is not None:
42+
IS_OPENSSL_1_1_1 = ssl.OPENSSL_VERSION_INFO >= (1, 1, 1)
43+
else:
44+
IS_OPENSSL_1_1_1 = False
45+
46+
4147
def data_file(filename):
4248
if hasattr(support, 'TEST_HOME_DIR'):
4349
fullname = os.path.join(support.TEST_HOME_DIR, filename)
@@ -1145,6 +1151,7 @@ def test_legacy_create_unix_server_ssl_verify_failed(self):
11451151
self.test_create_unix_server_ssl_verify_failed()
11461152

11471153
@unittest.skipIf(ssl is None, 'No ssl module')
1154+
@unittest.skipIf(IS_OPENSSL_1_1_1, "bpo-36576: fail on OpenSSL 1.1.1")
11481155
def test_create_server_ssl_match_failed(self):
11491156
proto = MyProto(loop=self.loop)
11501157
server, host, port = self._make_ssl_server(

Lib/test/test_ssl.py

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
HOST = support.HOST
2626
IS_LIBRESSL = ssl.OPENSSL_VERSION.startswith('LibreSSL')
2727
IS_OPENSSL_1_1 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0)
28+
IS_OPENSSL_1_1_1 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 1)
2829

2930

3031
def data_file(*name):
@@ -857,6 +858,7 @@ def test_ciphers(self):
857858
ctx.set_ciphers("^$:,;?*'dorothyx")
858859

859860
@skip_if_broken_ubuntu_ssl
861+
@unittest.skipIf(IS_OPENSSL_1_1_1, "bpo-36576: fail on OpenSSL 1.1.1")
860862
def test_options(self):
861863
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
862864
# OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value
@@ -3047,6 +3049,7 @@ def test_version_basic(self):
30473049
self.assertIs(s.version(), None)
30483050

30493051
@unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL")
3052+
@unittest.skipIf(IS_OPENSSL_1_1_1, "bpo-36576: fail on OpenSSL 1.1.1")
30503053
def test_default_ecdh_curve(self):
30513054
# Issue #21015: elliptic curve-based Diffie Hellman key exchange
30523055
# should be enabled by default on SSL contexts.
@@ -3176,6 +3179,7 @@ def test_selected_alpn_protocol_if_server_uses_alpn(self):
31763179
self.assertIs(stats['client_alpn_protocol'], None)
31773180

31783181
@unittest.skipUnless(ssl.HAS_ALPN, "ALPN support needed for this test")
3182+
@unittest.skipIf(IS_OPENSSL_1_1_1, "bpo-36576: fail on OpenSSL 1.1.1")
31793183
def test_alpn_protocols(self):
31803184
server_protocols = ['foo', 'bar', 'milkshake']
31813185
protocol_tests = [
@@ -3356,6 +3360,7 @@ def cb_wrong_return_type(ssl_sock, server_name, initial_context):
33563360
self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_INTERNAL_ERROR')
33573361
self.assertIn("TypeError", stderr.getvalue())
33583362

3363+
@unittest.skipIf(IS_OPENSSL_1_1_1, "bpo-36576: fail on OpenSSL 1.1.1")
33593364
def test_shared_ciphers(self):
33603365
server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
33613366
server_context.load_cert_chain(SIGNED_CERTFILE)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Skip test_ssl and test_asyncio tests failing with OpenSSL 1.1.1.

0 commit comments

Comments
 (0)