summaryrefslogtreecommitdiff
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.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/Lib/test/test_popen2.py b/Lib/test/test_popen2.py
index 2b7c30d371..ea4107534f 100644
--- a/Lib/test/test_popen2.py
+++ b/Lib/test/test_popen2.py
@@ -12,13 +12,13 @@ import sys
import unittest
import popen2
-from test.test_support import TestSkipped, run_unittest, reap_children
+from test.test_support import run_unittest, reap_children
if sys.platform[:4] == 'beos' or sys.platform[:6] == 'atheos':
# Locks get messed up or something. Generally we're supposed
# to avoid mixing "posix" fork & exec with native threads, and
# they may be right about that after all.
- raise TestSkipped("popen2() doesn't work on " + sys.platform)
+ raise unittest.SkipTest("popen2() doesn't work on " + sys.platform)
# if we don't have os.popen, check that
# we have os.fork. if not, skip the test
@@ -50,15 +50,21 @@ class Popen2Test(unittest.TestCase):
for inst in popen2._active:
inst.wait()
popen2._cleanup()
- self.assertFalse(popen2._active, "_active not empty")
+ self.assertFalse(popen2._active, "popen2._active not empty")
+ # The os.popen*() API delegates to the subprocess module (on Unix)
+ import subprocess
+ for inst in subprocess._active:
+ inst.wait()
+ subprocess._cleanup()
+ self.assertFalse(subprocess._active, "subprocess._active not empty")
reap_children()
def validate_output(self, teststr, expected_out, r, w, e=None):
w.write(teststr)
w.close()
got = r.read()
- self.assertEquals(expected_out, got.strip(), "wrote %r read %r" %
- (teststr, got))
+ self.assertEqual(expected_out, got.strip(), "wrote %r read %r" %
+ (teststr, got))
if e is not None:
got = e.read()
@@ -84,7 +90,7 @@ class Popen2Test(unittest.TestCase):
w, r = os.popen2(["echo", self.teststr])
got = r.read()
- self.assertEquals(got, self.teststr + "\n")
+ self.assertEqual(got, self.teststr + "\n")
w, r = os.popen2(self.cmd)
self.validate_output(self.teststr, self.expected, r, w)
@@ -97,7 +103,7 @@ class Popen2Test(unittest.TestCase):
w, r, e = os.popen3(["echo", self.teststr])
got = r.read()
- self.assertEquals(got, self.teststr + "\n")
+ self.assertEqual(got, self.teststr + "\n")
got = e.read()
self.assertFalse(got, "unexpected %r on stderr" % got)
@@ -111,7 +117,7 @@ class Popen2Test(unittest.TestCase):
w, r = os.popen4(["echo", self.teststr])
got = r.read()
- self.assertEquals(got, self.teststr + "\n")
+ self.assertEqual(got, self.teststr + "\n")
w, r = os.popen4(self.cmd)
self.validate_output(self.teststr, self.expected, r, w)