Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 38d773b

Browse files
committed
(Merge 3.4) asyncio: Fix test_stdin_broken_pipe(), drain() is not a coroutine
2 parents 56e8c29 + 0dee8ad commit 38d773b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Lib/test/test_asyncio/test_subprocess.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,15 @@ def prepare_broken_pipe_test(self):
141141
def test_stdin_broken_pipe(self):
142142
proc, large_data = self.prepare_broken_pipe_test()
143143

144+
@asyncio.coroutine
145+
def write_stdin(proc, data):
146+
proc.stdin.write(data)
147+
yield from proc.stdin.drain()
148+
149+
coro = write_stdin(proc, large_data)
144150
# drain() must raise BrokenPipeError or ConnectionResetError
145-
proc.stdin.write(large_data)
146151
self.assertRaises((BrokenPipeError, ConnectionResetError),
147-
self.loop.run_until_complete, proc.stdin.drain())
152+
self.loop.run_until_complete, coro)
148153
self.loop.run_until_complete(proc.wait())
149154

150155
def test_communicate_ignore_broken_pipe(self):

0 commit comments

Comments
 (0)