summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-02-17 21:54:11 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-02-17 21:54:11 (GMT)
commit4088ad9dcef0d7bbe26dc4a2527d4220ac558f53 (patch)
tree3e968b6926155df723faa6abaa750afaf6ff29ba /Lib
parent4cb814c7e1840b9e4d479cc43e65b6fff451ae90 (diff)
downloadcpython-4088ad9dcef0d7bbe26dc4a2527d4220ac558f53.zip
cpython-4088ad9dcef0d7bbe26dc4a2527d4220ac558f53.tar.gz
cpython-4088ad9dcef0d7bbe26dc4a2527d4220ac558f53.tar.bz2
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.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_asyncio/test_subprocess.py12
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
index de0b08a..92bf1b4 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -355,11 +355,19 @@ class SubprocessMixin:
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():