diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-05-29 21:22:40 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-05-29 21:22:40 (GMT) |
commit | 856ff5f986b248e9568d7efdb71f4ab6d232a51d (patch) | |
tree | 251cc6c06f33c1b6fd5a00b22f5fe6208051b2dd /Lib/test/test_platform.py | |
parent | 8a4e0ab51bddcb327650c744feff99a76574f72a (diff) | |
download | cpython-856ff5f986b248e9568d7efdb71f4ab6d232a51d.zip cpython-856ff5f986b248e9568d7efdb71f4ab6d232a51d.tar.gz cpython-856ff5f986b248e9568d7efdb71f4ab6d232a51d.tar.bz2 |
Merged revisions 63460,63464 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63460 | ronald.oussoren | 2008-05-18 15:54:47 -0500 (Sun, 18 May 2008) | 6 lines
- Add unittests for platform.mac_ver (or rather, ensure that the unittest for
that function actually tests something on OSX).
- Add documentation to platform.mac_ver that explains why the middle element
of the return value will not contain useful information.
........
r63464 | benjamin.peterson | 2008-05-18 17:07:42 -0500 (Sun, 18 May 2008) | 2 lines
fix test_platform (os was not imported)
........
Diffstat (limited to 'Lib/test/test_platform.py')
-rw-r--r-- | Lib/test/test_platform.py | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index 3758060..bc02d1e 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -1,4 +1,5 @@ import sys +import os import unittest import platform @@ -63,12 +64,29 @@ class PlatformTest(unittest.TestCase): def test_mac_ver(self): res = platform.mac_ver() - try: - import gestalt - except ImportError: pass - else: - if sys.platform == 'darwin': - self.assert_(all(res)) + + if os.uname()[0] == 'Darwin': + # We're on a MacOSX system, check that + # the right version information is returned + fd = os.popen('sw_vers', 'r') + real_ver = None + for ln in fd: + if ln.startswith('ProductVersion:'): + real_ver = ln.strip().split()[-1] + break + fd.close() + self.failIf(real_ver is None) + self.assertEquals(res[0], real_ver) + + # res[1] claims to contain + # (version, dev_stage, non_release_version) + # That information is no longer available + self.assertEquals(res[1], ('', '', '')) + + if sys.byteorder == 'little': + self.assertEquals(res[2], 'i386') + else: + self.assertEquals(res[2], 'PowerPC') def test_dist(self): res = platform.dist() |