]> granicus.if.org Git - python/commitdiff
test_platform fails on OS X Snow Leopard because the UNIX command to get the
authorBrett Cannon <bcannon@gmail.com>
Thu, 3 Sep 2009 21:25:21 +0000 (21:25 +0000)
committerBrett Cannon <bcannon@gmail.com>
Thu, 3 Sep 2009 21:25:21 +0000 (21:25 +0000)
canonical version, sw_vers, leaves off trailing zeros in the version number
(e.g. 10.6 instead of 10.6.0). Test now compensates by tacking on extra zeros
for the test comparison.

Fixes issue #6806.

Lib/test/test_platform.py
Misc/NEWS

index 63d5da215c5fc52c4310c5de1cf1320c6252a6cb..bd3b234b8e9aca7bfce01ff2c763f8efd4593bb6 100644 (file)
@@ -156,7 +156,13 @@ class PlatformTest(unittest.TestCase):
                     break
             fd.close()
             self.assertFalse(real_ver is None)
-            self.assertEquals(res[0], real_ver)
+            result_list = res[0].split('.')
+            expect_list = real_ver.split('.')
+            len_diff = len(result_list) - len(expect_list)
+            # On Snow Leopard, sw_vers reports 10.6.0 as 10.6
+            if len_diff > 0:
+                expect_list.extend(['0'] * len_diff)
+            self.assertEquals(result_list, expect_list)
 
             # res[1] claims to contain
             # (version, dev_stage, non_release_version)
index dfb2e223e473a3084072029dd2cb141c899cd624..f98706c0a72579d79b5d1142755c71fa08796347 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1328,6 +1328,9 @@ Extension Modules
 Tests
 -----
 
+- Issue #6806: test_platform failed under OS X 10.6.0 because ``sw_ver`` leaves
+  off the trailing 0 in the version number.
+
 - Issue #5450: Moved tests involving loading tk from Lib/test/test_tcl to
   Lib/lib-tk/test/test_tkinter/test_loadtk. With this, these tests demonstrate
   the same behaviour as test_ttkguionly (and now also test_tk) which is to