]> granicus.if.org Git - python/commitdiff
Issue #21976: Fix test_ssl to accept LibreSSL version strings.
authorAntoine Pitrou <solipsis@pitrou.net>
Mon, 21 Jul 2014 22:35:01 +0000 (18:35 -0400)
committerAntoine Pitrou <solipsis@pitrou.net>
Mon, 21 Jul 2014 22:35:01 +0000 (18:35 -0400)
Thanks to William Orr.

Lib/test/test_ssl.py
Misc/ACKS
Misc/NEWS

index 2b3de1f477e613968f93b44dfb561a4414f35507..d1cf5b27945bd3f191a36bf73a5257be730cc021 100644 (file)
@@ -281,11 +281,11 @@ class BasicSocketTests(unittest.TestCase):
         # 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)
@@ -294,9 +294,13 @@ class BasicSocketTests(unittest.TestCase):
         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):
index 0b557671bde07fb3d2546f27618772260a071ad2..f7c6be384f30cf7fa3929d21745e942f43d89fef 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -981,6 +981,7 @@ Piet van Oostrum
 Tomas Oppelstrup
 Jason Orendorff
 Douglas Orr
+William Orr
 Michele OrrĂ¹
 Oleg Oshmyan
 Denis S. Otkidach
index 08b3c6fa9196eb5274eddc8777cc875b690baa45..077b3a30947a9074a11f16685cb15d0172cf1ad1 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -203,6 +203,9 @@ IDLE
 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.