summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2010-01-27 01:25:02 (GMT)
committerEric Smith <eric@trueblade.com>2010-01-27 01:25:02 (GMT)
commit05f337440298c38a20f79d6a25de7e473272ea47 (patch)
tree77da80d447e8db198c3e9f4f20e8bec082f220c4
parent52b4b4509b5692f9813bf881e9254fb51b1b2188 (diff)
downloadcpython-05f337440298c38a20f79d6a25de7e473272ea47.zip
cpython-05f337440298c38a20f79d6a25de7e473272ea47.tar.gz
cpython-05f337440298c38a20f79d6a25de7e473272ea47.tar.bz2
Merged revisions 77775 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77775 | eric.smith | 2010-01-26 20:21:15 -0500 (Tue, 26 Jan 2010) | 1 line Switch to test_support.get_attribute. ........
-rw-r--r--Lib/test/test_sys.py47
1 files changed, 24 insertions, 23 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 37f01e9..e5d5a73 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -226,29 +226,30 @@ class SysModuleTest(unittest.TestCase):
err)
def test_getwindowsversion(self):
- if hasattr(sys, "getwindowsversion"):
- v = sys.getwindowsversion()
- self.assertEqual(len(v), 5)
- self.assertIsInstance(v[0], int)
- self.assertIsInstance(v[1], int)
- self.assertIsInstance(v[2], int)
- self.assertIsInstance(v[3], int)
- self.assertIsInstance(v[4], str)
- self.assertRaises(IndexError, operator.getitem, v, 5)
- self.assertIsInstance(v.major, int)
- self.assertIsInstance(v.minor, int)
- self.assertIsInstance(v.build, int)
- self.assertIsInstance(v.platform, int)
- self.assertIsInstance(v.service_pack, str)
- self.assertEqual(v[0], v.major)
- self.assertEqual(v[1], v.minor)
- self.assertEqual(v[2], v.build)
- self.assertEqual(v[3], v.platform)
- self.assertEqual(v[4], v.service_pack)
-
- # This is how platform.py calls it. Make sure tuple
- # still has 5 elements
- maj, min, buildno, plat, csd = sys.getwindowsversion()
+ # Raise SkipTest if sys doesn't have getwindowsversion attribute
+ test.test_support.get_attribute(sys, "getwindowsversion")
+ v = sys.getwindowsversion()
+ self.assertEqual(len(v), 5)
+ self.assertIsInstance(v[0], int)
+ self.assertIsInstance(v[1], int)
+ self.assertIsInstance(v[2], int)
+ self.assertIsInstance(v[3], int)
+ self.assertIsInstance(v[4], str)
+ self.assertRaises(IndexError, operator.getitem, v, 5)
+ self.assertIsInstance(v.major, int)
+ self.assertIsInstance(v.minor, int)
+ self.assertIsInstance(v.build, int)
+ self.assertIsInstance(v.platform, int)
+ self.assertIsInstance(v.service_pack, str)
+ self.assertEqual(v[0], v.major)
+ self.assertEqual(v[1], v.minor)
+ self.assertEqual(v[2], v.build)
+ self.assertEqual(v[3], v.platform)
+ self.assertEqual(v[4], v.service_pack)
+
+ # This is how platform.py calls it. Make sure tuple
+ # still has 5 elements
+ maj, min, buildno, plat, csd = sys.getwindowsversion()
def test_call_tracing(self):
self.assertRaises(TypeError, sys.call_tracing, type, 2)