mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
#1087: use proper skips in test_os.
This commit is contained in:
parent
461f41df5b
commit
c7e139b431
1 changed files with 13 additions and 13 deletions
|
@ -514,23 +514,23 @@ 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)
|
self.assertEqual(next(it), "line1\n")
|
||||||
self.assertEqual(next(it), "line1\n")
|
self.assertEqual(next(it), "line2\n")
|
||||||
self.assertEqual(next(it), "line2\n")
|
self.assertEqual(next(it), "line3\n")
|
||||||
self.assertEqual(next(it), "line3\n")
|
self.assertRaises(StopIteration, next, it)
|
||||||
self.assertRaises(StopIteration, next, it)
|
|
||||||
|
|
||||||
# Verify environ keys and values from the OS are of the
|
# Verify environ keys and values from the OS are of the
|
||||||
# correct str type.
|
# correct str type.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue