[Python-checkins] cpython: Issue #13862: Relax zlib version test to avoid spurious failures.

nadeem.vawda python-checkins at python.org
Wed Jan 25 22:25:24 CET 2012


http://hg.python.org/cpython/rev/a5f8611ce81d
changeset:   74615:a5f8611ce81d
user:        Nadeem Vawda <nadeem.vawda at gmail.com>
date:        Wed Jan 25 23:16:50 2012 +0200
summary:
  Issue #13862: Relax zlib version test to avoid spurious failures.

files:
  Lib/test/test_zlib.py |  12 ++++++------
  Misc/NEWS             |   3 +++
  2 files changed, 9 insertions(+), 6 deletions(-)


diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -16,12 +16,12 @@
 class VersionTestCase(unittest.TestCase):
 
     def test_library_version(self):
-        # On the build system, ZLIB_RUNTIME_VERSION should match ZLIB_VERSION.
-        # ZLIB_RUNTIME_VERSION is the actual library version while ZLIB_VERSION
-        # is the version from the header file. On the build system, the headers
-        # should match with the library exactly. At runtime, only the first
-        # digit is required to match.
-        self.assertEqual(zlib.ZLIB_RUNTIME_VERSION, zlib.ZLIB_VERSION)
+        # Test that the major version of the actual library in use matches the
+        # major version that we were compiled against. We can't guarantee that
+        # the minor versions will match (even on the machine on which the module
+        # was compiled), and the API is stable between minor versions, so
+        # testing only the major verions avoids spurious failures.
+        self.assertEqual(zlib.ZLIB_RUNTIME_VERSION[0], zlib.ZLIB_VERSION[0])
 
 
 class ChecksumTestCase(unittest.TestCase):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -461,6 +461,9 @@
 Library
 -------
 
+- Issue #13862: Fix spurious failure in test_zlib due to runtime/compile time
+  minor versions not matching.
+
 - Issue #12804: Fix test_socket and test_urllib2net failures when running tests
   on a system without internet access.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list