Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26408df

Browse files
committed
Issue #21976: Fix test_ssl to accept LibreSSL version strings.
Thanks to William Orr.
2 parents 41323e7 + dfab935 commit 26408df

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
@@ -295,11 +295,11 @@ def test_openssl_version(self):
295295
# Some sanity checks follow
296296
# >= 0.9
297297
self.assertGreaterEqual(n, 0x900000)
298-
# < 2.0
299-
self.assertLess(n, 0x20000000)
298+
# < 3.0
299+
self.assertLess(n, 0x30000000)
300300
major, minor, fix, patch, status = t
301301
self.assertGreaterEqual(major, 0)
302-
self.assertLess(major, 2)
302+
self.assertLess(major, 3)
303303
self.assertGreaterEqual(minor, 0)
304304
self.assertLess(minor, 256)
305305
self.assertGreaterEqual(fix, 0)
@@ -308,9 +308,13 @@ def test_openssl_version(self):
308308
self.assertLessEqual(patch, 26)
309309
self.assertGreaterEqual(status, 0)
310310
self.assertLessEqual(status, 15)
311-
# Version string as returned by OpenSSL, the format might change
312-
self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
313-
(s, t))
311+
# Version string as returned by {Open,Libre}SSL, the format might change
312+
if "LibreSSL" in s:
313+
self.assertTrue(s.startswith("LibreSSL {:d}.{:d}".format(major, minor)),
314+
(s, t))
315+
else:
316+
self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)),
317+
(s, t))
314318

315319
@support.cpython_only
316320
def test_refcycle(self):

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ Piet van Oostrum
989989
Tomas Oppelstrup
990990
Jason Orendorff
991991
Douglas Orr
992+
William Orr
992993
Michele Orrù
993994
Oleg Oshmyan
994995
Denis S. Otkidach

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,9 @@ Documentation
704704
Tests
705705
-----
706706

707+
- Issue #21976: Fix test_ssl to accept LibreSSL version strings. Thanks
708+
to William Orr.
709+
707710
- Issue #21918: Converted test_tools from a module to a package containing
708711
separate test files for each tested script.
709712

0 commit comments

Comments
 (0)