[Python-checkins] cpython (3.4): Issue #23475, asyncio: Fix test_close_kill_running()

victor.stinner python-checkins at python.org
Tue Feb 17 23:14:21 CET 2015


https://hg.python.org/cpython/rev/0f6ddf944521
changeset: 94665:0f6ddf944521
branch: 3.4
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Feb 17 22:54:11 2015 +0100
summary:
 Issue #23475, asyncio: Fix test_close_kill_running()
Really kill the child process, don't mock completly the Popen.kill() method.
This change fix memory leaks and reference leaks.
files:
 Lib/test/test_asyncio/test_subprocess.py | 12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -355,11 +355,19 @@
 create = self.loop.subprocess_exec(asyncio.SubprocessProtocol,
 *PROGRAM_BLOCKED)
 transport, protocol = yield from create
+
+ kill_called = False
+ def kill():
+ nonlocal kill_called
+ kill_called = True
+ orig_kill()
+
 proc = transport.get_extra_info('subprocess')
- proc.kill = mock.Mock()
+ orig_kill = proc.kill
+ proc.kill = kill
 returncode = transport.get_returncode()
 transport.close()
- return (returncode, proc.kill.called)
+ return (returncode, kill_called)
 
 # Ignore "Close running child process: kill ..." log
 with test_utils.disable_logger():
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /