#1087: use proper skips in test_os.

This commit is contained in:
Ezio Melotti 2012-09-26 20:01:34 +03:00
parent 461f41df5b
commit c7e139b431

View file

@ -514,16 +514,16 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
return os.environ return os.environ
# Bug 1110478 # Bug 1110478
@unittest.skipUnless(os.path.exists('/bin/sh'), 'requires /bin/sh')
def test_update2(self): def test_update2(self):
os.environ.clear() os.environ.clear()
if os.path.exists("/bin/sh"):
os.environ.update(HELLO="World") os.environ.update(HELLO="World")
with os.popen("/bin/sh -c 'echo $HELLO'") as popen: with os.popen("/bin/sh -c 'echo $HELLO'") as popen:
value = popen.read().strip() value = popen.read().strip()
self.assertEqual(value, "World") self.assertEqual(value, "World")
@unittest.skipUnless(os.path.exists('/bin/sh'), 'requires /bin/sh')
def test_os_popen_iter(self): def test_os_popen_iter(self):
if os.path.exists("/bin/sh"):
with os.popen( with os.popen(
"/bin/sh -c 'echo \"line1\nline2\nline3\"'") as popen: "/bin/sh -c 'echo \"line1\nline2\nline3\"'") as popen:
it = iter(popen) it = iter(popen)