[Python-checkins] cpython: test_eintr: Fix ResourceWarning warnings

victor.stinner python-checkins at python.org
Sat Sep 10 04:28:38 EDT 2016


https://hg.python.org/cpython/rev/08094079c36c
changeset:   103561:08094079c36c
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Sep 10 04:19:48 2016 -0400
summary:
  test_eintr: Fix ResourceWarning warnings

files:
  Lib/test/eintrdata/eintr_tester.py |  5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py
--- a/Lib/test/eintrdata/eintr_tester.py
+++ b/Lib/test/eintrdata/eintr_tester.py
@@ -83,6 +83,9 @@
         processes = [self.new_sleep_process() for _ in range(num)]
         for _ in range(num):
             wait_func()
+        # Call the Popen method to avoid a ResourceWarning
+        for proc in processes:
+            proc.wait()
 
     def test_wait(self):
         self._test_wait_multiple(os.wait)
@@ -94,6 +97,8 @@
     def _test_wait_single(self, wait_func):
         proc = self.new_sleep_process()
         wait_func(proc.pid)
+        # Call the Popen method to avoid a ResourceWarning
+        proc.wait()
 
     def test_waitpid(self):
         self._test_wait_single(lambda pid: os.waitpid(pid, 0))

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


More information about the Python-checkins mailing list