summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_platform.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-05-16 02:24:49 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-05-16 02:24:49 (GMT)
commit5915a4dcfebf74d0a2c99848ede619f5bf7d2899 (patch)
treef0a4a9de75c082b71eab6d06edbe9be7a2e6a103 /Lib/test/test_platform.py
parenteb8cef26648d7d443a5570a2e653d9d07c284c42 (diff)
downloadcpython-5915a4dcfebf74d0a2c99848ede619f5bf7d2899.zip
cpython-5915a4dcfebf74d0a2c99848ede619f5bf7d2899.tar.gz
cpython-5915a4dcfebf74d0a2c99848ede619f5bf7d2899.tar.bz2
make test_platform a bit more assertive (We'll see what the buildbots say.)
Diffstat (limited to 'Lib/test/test_platform.py')
-rw-r--r--Lib/test/test_platform.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index 22307cd..fced4d0 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -1,7 +1,9 @@
+import sys
import unittest
-from test import test_support
import platform
+from test import test_support
+
class PlatformTest(unittest.TestCase):
def test_architecture(self):
res = platform.architecture()
@@ -49,26 +51,35 @@ class PlatformTest(unittest.TestCase):
def test_uname(self):
res = platform.uname()
+ self.assert_(any(res))
def test_java_ver(self):
res = platform.java_ver()
+ if sys.platform == 'java':
+ self.assert_(all(res))
def test_win32_ver(self):
res = platform.win32_ver()
def test_mac_ver(self):
res = platform.mac_ver()
+ try:
+ import gestalt
+ except ImportError: pass
+ else:
+ if sys.platform == 'darwin':
+ self.assert_(all(res))
def test_dist(self):
res = platform.dist()
def test_libc_ver(self):
- from sys import executable
import os
- if os.path.isdir(executable) and os.path.exists(executable+'.exe'):
+ if os.path.isdir(sys.executable) and \
+ os.path.exists(sys.executable+'.exe'):
# Cygwin horror
executable = executable + '.exe'
- res = platform.libc_ver(executable)
+ res = platform.libc_ver(sys.executable)
def test_main():
test_support.run_unittest(