summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_popen2.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-03-24 08:14:54 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-03-24 08:14:54 (GMT)
commit478c82d30f0568cf3b418819d4189c8a072e589d (patch)
tree89aab19ea8086c5e875782b2e9f513ba841660d4 /Lib/test/test_popen2.py
parent846d72a7d7536ea6ad9b530b1a96c354fb623115 (diff)
downloadcpython-478c82d30f0568cf3b418819d4189c8a072e589d.zip
cpython-478c82d30f0568cf3b418819d4189c8a072e589d.tar.gz
cpython-478c82d30f0568cf3b418819d4189c8a072e589d.tar.bz2
Bug #1183780: Add Popen objects to _active only in __del__.
Cleanup terminated processes as well. Add cmd attribute to Popen4.
Diffstat (limited to 'Lib/test/test_popen2.py')
-rw-r--r--Lib/test/test_popen2.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_popen2.py b/Lib/test/test_popen2.py
index 18142ec..4db3cd1 100644
--- a/Lib/test/test_popen2.py
+++ b/Lib/test/test_popen2.py
@@ -35,6 +35,9 @@ def _test():
# same test as popen2._test(), but using the os.popen*() API
print "Testing os module:"
import popen2
+ # When the test runs, there shouldn't be any open pipes
+ popen2._cleanup()
+ assert not popen2._active, "Active pipes when test starts " + repr([c.cmd for c in popen2._active])
cmd = "cat"
teststr = "ab cd\n"
if os.name == "nt":
@@ -65,6 +68,7 @@ def _test():
raise ValueError("unexpected %r on stderr" % (got,))
for inst in popen2._active[:]:
inst.wait()
+ popen2._cleanup()
if popen2._active:
raise ValueError("_active not empty")
print "All OK"