diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-07-21 22:37:36 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-07-21 22:37:36 (GMT) |
commit | 26408df88fa6d84f0702964cef60e74c7830c066 (patch) | |
tree | f8dbea43e534dea4c67d1ad7aabc6449c9e42ff5 /Lib/test/test_ssl.py | |
parent | 41323e7483b2d273d1d53cfba4bc92c6697b960e (diff) | |
parent | dfab935c74745133234dded912ec1b0721888505 (diff) | |
download | cpython-26408df88fa6d84f0702964cef60e74c7830c066.zip cpython-26408df88fa6d84f0702964cef60e74c7830c066.tar.gz cpython-26408df88fa6d84f0702964cef60e74c7830c066.tar.bz2 |
Issue #21976: Fix test_ssl to accept LibreSSL version strings.
Thanks to William Orr.
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r-- | Lib/test/test_ssl.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index bdde9ac..80fb062 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -295,11 +295,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) @@ -308,9 +308,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): |