(Merge 3.4) asyncio: Fix test_stdin_broken_pipe(), drain() is not a coroutine

This commit is contained in:
Victor Stinner 2014-07-21 16:23:51 +02:00
commit 38d773bd10
1 changed files with 7 additions and 2 deletions

View File

@ -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):