]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #26741: Clean up subprocess.Popen object in test_poll
authorMartin Panter <vadmium+py@gmail.com>
Fri, 12 Aug 2016 11:59:52 +0000 (11:59 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Fri, 12 Aug 2016 11:59:52 +0000 (11:59 +0000)
Lib/test/test_poll.py

index a0a332bdbcb75c93dcf21bf1b304902ae7f306dd..6a2bf6ea7b77c9e9ecbc3f4a70174de72dec7298 100644 (file)
@@ -125,6 +125,8 @@ class PollTests(unittest.TestCase):
         cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
         proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
                                 bufsize=0)
+        proc.__enter__()
+        self.addCleanup(proc.__exit__, None, None, None)
         p = proc.stdout
         pollster = select.poll()
         pollster.register( p, select.POLLIN )
@@ -147,7 +149,6 @@ class PollTests(unittest.TestCase):
                 continue
             else:
                 self.fail('Unexpected return value from select.poll: %s' % fdlist)
-        p.close()
 
     def test_poll3(self):
         # test int overflow