[Python-checkins] cpython (merge 3.4 -> default): Issue #21976: Fix test_ssl to accept LibreSSL version strings.

antoine.pitrou python-checkins at python.org
Tue Jul 22 00:37:51 CEST 2014


http://hg.python.org/cpython/rev/98aec1d9e2a0
changeset:   91753:98aec1d9e2a0
parent:      91751:168cd3d19fef
parent:      91752:4dac45f88d45
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Mon Jul 21 18:37:36 2014 -0400
summary:
  Issue #21976: Fix test_ssl to accept LibreSSL version strings.
Thanks to William Orr.

files:
  Lib/test/test_ssl.py |  16 ++++++++++------
  Misc/ACKS            |   1 +
  Misc/NEWS            |   3 +++
  3 files changed, 14 insertions(+), 6 deletions(-)


diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -295,11 +295,11 @@
         # Some sanity checks follow
         # >= 0.9
         self.assertGreaterEqual(n, 0x900000)
-        # < 2.0
-        self.assertLess(n, 0x20000000)
+        # < 3.0
+        self.assertLess(n, 0x30000000)
         major, minor, fix, patch, status = t
         self.assertGreaterEqual(major, 0)
-        self.assertLess(major, 2)
+        self.assertLess(major, 3)
         self.assertGreaterEqual(minor, 0)
         self.assertLess(minor, 256)
         self.assertGreaterEqual(fix, 0)
@@ -308,9 +308,13 @@
         self.assertLessEqual(patch, 26)
         self.assertGreaterEqual(status, 0)
         self.assertLessEqual(status, 15)
-        # Version string as returned by OpenSSL, the format might change
-        self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
-                        (s, t))
+        # Version string as returned by {Open,Libre}SSL, the format might change
+        if "LibreSSL" in s:
+            self.assertTrue(s.startswith("LibreSSL {:d}.{:d}".format(major, minor)),
+                            (s, t))
+        else:
+            self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
+                            (s, t))
 
     @support.cpython_only
     def test_refcycle(self):
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -989,6 +989,7 @@
 Tomas Oppelstrup
 Jason Orendorff
 Douglas Orr
+William Orr
 Michele Orrù
 Oleg Oshmyan
 Denis S. Otkidach
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -704,6 +704,9 @@
 Tests
 -----
 
+- Issue #21976: Fix test_ssl to accept LibreSSL version strings.  Thanks
+  to William Orr.
+
 - Issue #21918: Converted test_tools from a module to a package containing
   separate test files for each tested script.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list