From a913b4dafd1d85cfa1d8bafeea5417748de8d487 Mon Sep 17 00:00:00 2001 From: Briehan Lombaard Date: Wed, 16 May 2018 14:21:19 +0200 Subject: [PATCH] SSLContext was added in Python 2.7.9 --- flask/cli.py | 4 ++-- tests/test_cli.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flask/cli.py b/flask/cli.py index efc1733e29..f7c603a17e 100644 --- a/flask/cli.py +++ b/flask/cli.py @@ -670,7 +670,7 @@ def convert(self, value, param, ctx): obj = import_string(value, silent=True) - if sys.version_info < (2, 7): + if sys.version_info < (2, 7, 9): if obj: return obj else: @@ -687,7 +687,7 @@ def _validate_key(ctx, param, value): cert = ctx.params.get('cert') is_adhoc = cert == 'adhoc' - if sys.version_info < (2, 7): + if sys.version_info < (2, 7, 9): is_context = cert and not isinstance(cert, (text_type, bytes)) else: is_context = isinstance(cert, ssl.SSLContext) diff --git a/tests/test_cli.py b/tests/test_cli.py index 387eeeba54..ee03826542 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -521,12 +521,12 @@ def test_run_cert_import(monkeypatch): run_command.make_context('run', ['--cert', 'not_here']) # not an SSLContext - if sys.version_info >= (2, 7): + if sys.version_info >= (2, 7, 9): with pytest.raises(click.BadParameter): run_command.make_context('run', ['--cert', 'flask']) # SSLContext - if sys.version_info < (2, 7): + if sys.version_info < (2, 7, 9): ssl_context = object() else: ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)