]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added unit test to verify that #1087 is invalid. os.popen is using subprocess.
authorChristian Heimes <christian@cheimes.de>
Thu, 8 Nov 2007 14:16:55 +0000 (14:16 +0000)
committerChristian Heimes <christian@cheimes.de>
Thu, 8 Nov 2007 14:16:55 +0000 (14:16 +0000)
Lib/test/test_os.py

index 088101fd2b2bc71015528b346ebc086514d7ba0a..15ed5578f9a2756b70927cf1f6926574786be6ea 100644 (file)
@@ -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):