diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2008-05-18 20:54:47 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2008-05-18 20:54:47 (GMT) |
commit | 7a0f4c75b1d2e3ceb758970ad39d468e95dfc6ed (patch) | |
tree | 1804777b3b92bdedb3d9ac5cad9cb71da2e91151 /Lib/test | |
parent | f5c38dadf6b60839812fa450091cbbbed0a42655 (diff) | |
download | cpython-7a0f4c75b1d2e3ceb758970ad39d468e95dfc6ed.zip cpython-7a0f4c75b1d2e3ceb758970ad39d468e95dfc6ed.tar.gz cpython-7a0f4c75b1d2e3ceb758970ad39d468e95dfc6ed.tar.bz2 |
- 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.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_platform.py | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index fced4d0..f337fba 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -63,12 +63,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() |