diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-09-26 17:01:34 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-09-26 17:01:34 (GMT) |
commit | c7e139b431b0180d6be9b9d5bfe45b37ea01a14a (patch) | |
tree | 5fdff0da2e872223eca572ab44b62afa651118ab /Lib | |
parent | 461f41df5bc7a1a35b2ad7ae8654dbc953ca1dc6 (diff) | |
download | cpython-c7e139b431b0180d6be9b9d5bfe45b37ea01a14a.zip cpython-c7e139b431b0180d6be9b9d5bfe45b37ea01a14a.tar.gz cpython-c7e139b431b0180d6be9b9d5bfe45b37ea01a14a.tar.bz2 |
#1087: use proper skips in test_os.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_os.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 6219eff..7d6b377 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -514,23 +514,23 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol): return os.environ # Bug 1110478 + @unittest.skipUnless(os.path.exists('/bin/sh'), 'requires /bin/sh') def test_update2(self): os.environ.clear() - if os.path.exists("/bin/sh"): - os.environ.update(HELLO="World") - with os.popen("/bin/sh -c 'echo $HELLO'") as popen: - value = popen.read().strip() - self.assertEqual(value, "World") + os.environ.update(HELLO="World") + with os.popen("/bin/sh -c 'echo $HELLO'") as popen: + value = popen.read().strip() + self.assertEqual(value, "World") + @unittest.skipUnless(os.path.exists('/bin/sh'), 'requires /bin/sh') def test_os_popen_iter(self): - if os.path.exists("/bin/sh"): - with os.popen( - "/bin/sh -c 'echo \"line1\nline2\nline3\"'") as popen: - it = iter(popen) - self.assertEqual(next(it), "line1\n") - self.assertEqual(next(it), "line2\n") - self.assertEqual(next(it), "line3\n") - self.assertRaises(StopIteration, next, it) + with os.popen( + "/bin/sh -c 'echo \"line1\nline2\nline3\"'") as popen: + it = iter(popen) + self.assertEqual(next(it), "line1\n") + self.assertEqual(next(it), "line2\n") + self.assertEqual(next(it), "line3\n") + self.assertRaises(StopIteration, next, it) # Verify environ keys and values from the OS are of the # correct str type. |