mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
- 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.
This commit is contained in:
parent
f5c38dadf6
commit
7a0f4c75b1
2 changed files with 29 additions and 6 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue