Skip to content

Commit dfab935

Browse files
committed
Issue python#21976: Fix test_ssl to accept LibreSSL version strings.
Thanks to William Orr.
1 parent 47ae763 commit dfab935

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

Lib/test/test_ssl.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ def test_openssl_version(self):
281281
# Some sanity checks follow
282282
# >= 0.9
283283
self.assertGreaterEqual(n, 0x900000)
284-
# < 2.0
285-
self.assertLess(n, 0x20000000)
284+
# < 3.0
285+
self.assertLess(n, 0x30000000)
286286
major, minor, fix, patch, status = t
287287
self.assertGreaterEqual(major, 0)
288-
self.assertLess(major, 2)
288+
self.assertLess(major, 3)
289289
self.assertGreaterEqual(minor, 0)
290290
self.assertLess(minor, 256)
291291
self.assertGreaterEqual(fix, 0)
@@ -294,9 +294,13 @@ def test_openssl_version(self):
294294
self.assertLessEqual(patch, 26)
295295
self.assertGreaterEqual(status, 0)
296296
self.assertLessEqual(status, 15)
297-
# Version string as returned by OpenSSL, the format might change
298-
self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
299-
(s, t))
297+
# Version string as returned by {Open,Libre}SSL, the format might change
298+
if "LibreSSL" in s:
299+
self.assertTrue(s.startswith("LibreSSL {:d}.{:d}".format(major, minor)),
300+
(s, t))
301+
else:
302+
self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
303+
(s, t))
300304

301305
@support.cpython_only
302306
def test_refcycle(self):

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ Piet van Oostrum
981981
Tomas Oppelstrup
982982
Jason Orendorff
983983
Douglas Orr
984+
William Orr
984985
Michele Orrù
985986
Oleg Oshmyan
986987
Denis S. Otkidach

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ IDLE
203203
Tests
204204
-----
205205

206+
- Issue #21976: Fix test_ssl to accept LibreSSL version strings. Thanks
207+
to William Orr.
208+
206209
- Issue #21918: Converted test_tools from a module to a package containing
207210
separate test files for each tested script.
208211

0 commit comments

Comments
 (0)