summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pipes.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_pipes.py')
-rw-r--r--Lib/test/test_pipes.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_pipes.py b/Lib/test/test_pipes.py
index b816a3b..f2b58d5 100644
--- a/Lib/test/test_pipes.py
+++ b/Lib/test/test_pipes.py
@@ -2,7 +2,7 @@ import pipes
import os
import string
import unittest
-from test.support import TESTFN, run_unittest, unlink
+from test.support import TESTFN, run_unittest, unlink, reap_children
if os.name != 'posix':
raise unittest.SkipTest('pipes module only works on posix')
@@ -40,7 +40,11 @@ class SimplePipeTests(unittest.TestCase):
f.write('hello world #2')
t = pipes.Template()
t.append(s_command + ' < $IN', pipes.FILEIN_STDOUT)
- self.assertEqual(t.open(TESTFN, 'r').read(), 'HELLO WORLD #2')
+ f = t.open(TESTFN, 'r')
+ try:
+ self.assertEqual(f.read(), 'HELLO WORLD #2')
+ finally:
+ f.close()
def testEmptyPipeline1(self):
# copy through empty pipe
@@ -60,7 +64,11 @@ class SimplePipeTests(unittest.TestCase):
with open(TESTFN, 'w') as f:
f.write(d)
t=pipes.Template()
- self.assertEqual(t.open(TESTFN, 'r').read(), d)
+ f = t.open(TESTFN, 'r')
+ try:
+ self.assertEqual(f.read(), d)
+ finally:
+ f.close()
def testEmptyPipeline3(self):
# write through empty pipe
@@ -196,6 +204,7 @@ class SimplePipeTests(unittest.TestCase):
def test_main():
run_unittest(SimplePipeTests)
+ reap_children()
if __name__ == "__main__":
test_main()