summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_popen2.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_popen2.py')
-rw-r--r--Lib/test/test_popen2.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_popen2.py b/Lib/test/test_popen2.py
index 023871f..2b7c30d 100644
--- a/Lib/test/test_popen2.py
+++ b/Lib/test/test_popen2.py
@@ -78,6 +78,14 @@ class Popen2Test(unittest.TestCase):
def test_os_popen2(self):
# same test as test_popen2(), but using the os.popen*() API
+ if os.name == 'posix':
+ w, r = os.popen2([self.cmd])
+ self.validate_output(self.teststr, self.expected, r, w)
+
+ w, r = os.popen2(["echo", self.teststr])
+ got = r.read()
+ self.assertEquals(got, self.teststr + "\n")
+
w, r = os.popen2(self.cmd)
self.validate_output(self.teststr, self.expected, r, w)
@@ -87,9 +95,27 @@ class Popen2Test(unittest.TestCase):
w, r, e = os.popen3([self.cmd])
self.validate_output(self.teststr, self.expected, r, w, e)
+ w, r, e = os.popen3(["echo", self.teststr])
+ got = r.read()
+ self.assertEquals(got, self.teststr + "\n")
+ got = e.read()
+ self.assertFalse(got, "unexpected %r on stderr" % got)
+
w, r, e = os.popen3(self.cmd)
self.validate_output(self.teststr, self.expected, r, w, e)
+ def test_os_popen4(self):
+ if os.name == 'posix':
+ w, r = os.popen4([self.cmd])
+ self.validate_output(self.teststr, self.expected, r, w)
+
+ w, r = os.popen4(["echo", self.teststr])
+ got = r.read()
+ self.assertEquals(got, self.teststr + "\n")
+
+ w, r = os.popen4(self.cmd)
+ self.validate_output(self.teststr, self.expected, r, w)
+
def test_main():
run_unittest(Popen2Test)