Issue #21976: Fix test_ssl to accept LibreSSL version strings.

Thanks to William Orr.
This commit is contained in:
Antoine Pitrou 2014-07-21 18:35:01 -04:00
parent 47ae763d28
commit dfab935c74
3 changed files with 14 additions and 6 deletions

View file

@ -281,11 +281,11 @@ class BasicSocketTests(unittest.TestCase):
# Some sanity checks follow # Some sanity checks follow
# >= 0.9 # >= 0.9
self.assertGreaterEqual(n, 0x900000) self.assertGreaterEqual(n, 0x900000)
# < 2.0 # < 3.0
self.assertLess(n, 0x20000000) self.assertLess(n, 0x30000000)
major, minor, fix, patch, status = t major, minor, fix, patch, status = t
self.assertGreaterEqual(major, 0) self.assertGreaterEqual(major, 0)
self.assertLess(major, 2) self.assertLess(major, 3)
self.assertGreaterEqual(minor, 0) self.assertGreaterEqual(minor, 0)
self.assertLess(minor, 256) self.assertLess(minor, 256)
self.assertGreaterEqual(fix, 0) self.assertGreaterEqual(fix, 0)
@ -294,9 +294,13 @@ class BasicSocketTests(unittest.TestCase):
self.assertLessEqual(patch, 26) self.assertLessEqual(patch, 26)
self.assertGreaterEqual(status, 0) self.assertGreaterEqual(status, 0)
self.assertLessEqual(status, 15) self.assertLessEqual(status, 15)
# Version string as returned by OpenSSL, the format might change # Version string as returned by {Open,Libre}SSL, the format might change
self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)), if "LibreSSL" in s:
(s, t)) 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 @support.cpython_only
def test_refcycle(self): def test_refcycle(self):

View file

@ -981,6 +981,7 @@ Piet van Oostrum
Tomas Oppelstrup Tomas Oppelstrup
Jason Orendorff Jason Orendorff
Douglas Orr Douglas Orr
William Orr
Michele Orrù Michele Orrù
Oleg Oshmyan Oleg Oshmyan
Denis S. Otkidach Denis S. Otkidach

View file

@ -203,6 +203,9 @@ IDLE
Tests 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 - Issue #21918: Converted test_tools from a module to a package containing
separate test files for each tested script. separate test files for each tested script.