[Python-checkins] cpython (3.5): Issue #26741: Clean up subprocess.Popen object in test_poll

martin.panter python-checkins at python.org
Fri Aug 12 08:18:38 EDT 2016


https://hg.python.org/cpython/rev/f78a682a3515
changeset:   102615:f78a682a3515
branch:      3.5
user:        Martin Panter <vadmium+py at gmail.com>
date:        Fri Aug 12 11:59:52 2016 +0000
summary:
  Issue #26741: Clean up subprocess.Popen object in test_poll

files:
  Lib/test/test_poll.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -125,6 +125,8 @@
         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 @@
                 continue
             else:
                 self.fail('Unexpected return value from select.poll: %s' % fdlist)
-        p.close()
 
     def test_poll3(self):
         # test int overflow

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list