diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2015-02-17 22:45:35 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2015-02-17 22:45:35 +0100 |
| commit | c18c4d06bb6501e7192aa93dbe8af7de44c95386 (patch) | |
| tree | 8ee9711d5018afe491d520d6249979be927e39dd /tests | |
| parent | b60bad4ec86069d0a8edd0209b033a9afcc5d25a (diff) | |
| download | trollius-git-c18c4d06bb6501e7192aa93dbe8af7de44c95386.tar.gz | |
Python issue #23475: 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 'tests')
| -rw-r--r-- | tests/test_subprocess.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/test_subprocess.py b/tests/test_subprocess.py index de0b08a..92bf1b4 100644 --- a/tests/test_subprocess.py +++ b/tests/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(): |
