[Python-3000-checkins] r58912 - python/branches/py3k/Lib/test/test_os.py

christian.heimes python-3000-checkins at python.org
Thu Nov 8 15:16:56 CET 2007


Author: christian.heimes
Date: Thu Nov  8 15:16:55 2007
New Revision: 58912

Modified:
   python/branches/py3k/Lib/test/test_os.py
Log:
Added unit test to verify that #1087 is invalid. os.popen is using subprocess.

Modified: python/branches/py3k/Lib/test/test_os.py
==============================================================================
--- python/branches/py3k/Lib/test/test_os.py	(original)
+++ python/branches/py3k/Lib/test/test_os.py	Thu Nov  8 15:16:55 2007
@@ -216,6 +216,15 @@
             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):


More information about the Python-3000-checkins mailing list