summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-08 14:16:55 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-11-08 14:16:55 (GMT)
commit1a13d597093422d666e0efa3d6d51f8a507b5317 (patch)
treeaad5e5022069d9de73e6bf088112dc36040c3601 /Lib/test/test_os.py
parent3795b53e8d80be555b6599dbb30476fa66f01e55 (diff)
downloadcpython-1a13d597093422d666e0efa3d6d51f8a507b5317.zip
cpython-1a13d597093422d666e0efa3d6d51f8a507b5317.tar.gz
cpython-1a13d597093422d666e0efa3d6d51f8a507b5317.tar.bz2
Added unit test to verify that #1087 is invalid. os.popen is using subprocess.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 088101f..15ed557 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -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):