mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Added unit test to verify that #1087 is invalid. os.popen is using subprocess.
This commit is contained in:
parent
3795b53e8d
commit
1a13d59709
1 changed files with 9 additions and 0 deletions
|
|
@ -216,6 +216,15 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
|
|||
value = os.popen("/bin/sh -c 'echo $HELLO'").read().strip()
|
||||
self.assertEquals(value, "World")
|
||||
|
||||
def test_os_popen_iter(self):
|
||||
if os.path.exists("/bin/sh"):
|
||||
popen = os.popen("/bin/sh -c 'echo \"line1\nline2\nline3\"'")
|
||||
it = iter(popen)
|
||||
self.assertEquals(next(it), "line1\n")
|
||||
self.assertEquals(next(it), "line2\n")
|
||||
self.assertEquals(next(it), "line3\n")
|
||||
self.assertRaises(StopIteration, next, it)
|
||||
|
||||
# Verify environ keys and values from the OS are of the
|
||||
# correct str type.
|
||||
def test_keyvalue_types(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue