summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2019-09-26 16:23:17 (GMT)
committerGitHub <noreply@github.com>2019-09-26 16:23:17 (GMT)
commit9f77268f901cc3e8874e5042361520a0e482476a (patch)
tree9629135114946800fb0ad06c27d9df1a1d23b21a /Lib/test/test_ssl.py
parentdf6ac7e2b82d921a6e9ff5571b40c6dbcf635581 (diff)
downloadcpython-9f77268f901cc3e8874e5042361520a0e482476a.zip
cpython-9f77268f901cc3e8874e5042361520a0e482476a.tar.gz
cpython-9f77268f901cc3e8874e5042361520a0e482476a.tar.bz2
bpo-38275: Fix test_ssl issue caused by GH-16386 (#16428)
Check presence of SSLContext.minimum_version to make tests pass with old versions of OpenSSL. Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 8bb74b4..3cd6e92 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -190,11 +190,13 @@ def has_tls_version(version):
# be compiled in but disabled by a policy or config option.
ctx = ssl.SSLContext()
if (
+ hasattr(ctx, 'minimum_version') and
ctx.minimum_version != ssl.TLSVersion.MINIMUM_SUPPORTED and
version < ctx.minimum_version
):
return False
if (
+ hasattr(ctx, 'maximum_version') and
ctx.maximum_version != ssl.TLSVersion.MAXIMUM_SUPPORTED and
version > ctx.maximum_version
):