From: Victor Stinner Date: Mon, 21 Jul 2014 14:23:33 +0000 (+0200) Subject: asyncio: Fix test_stdin_broken_pipe(), drain() is not a coroutine X-Git-Tag: v3.4.2rc1~201 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0dee8ad579c57ee533251004f66f1f4c6fee1691;p=thirdparty%2FPython%2Fcpython.git asyncio: Fix test_stdin_broken_pipe(), drain() is not a coroutine --- diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 5425d9bfd5eb..a4e9df2f8eda 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -141,10 +141,15 @@ class SubprocessMixin: def test_stdin_broken_pipe(self): proc, large_data = self.prepare_broken_pipe_test() + @asyncio.coroutine + def write_stdin(proc, data): + proc.stdin.write(data) + yield from proc.stdin.drain() + + coro = write_stdin(proc, large_data) # drain() must raise BrokenPipeError or ConnectionResetError - proc.stdin.write(large_data) self.assertRaises((BrokenPipeError, ConnectionResetError), - self.loop.run_until_complete, proc.stdin.drain()) + self.loop.run_until_complete, coro) self.loop.run_until_complete(proc.wait()) def test_communicate_ignore_broken_pipe(self):