[Python-checkins] A better fix for asyncio test_stdin_broken_pipe (#7221)
Yury Selivanov
webhook-mailer at python.org
Tue May 29 20:57:53 EDT 2018
https://github.com/python/cpython/commit/ad74d50517c069359578014bb32e660828d68332
commit: ad74d50517c069359578014bb32e660828d68332
branch: master
author: Yury Selivanov <yury at magic.io>
committer: GitHub <noreply at github.com>
date: 2018-05-29T20:57:50-04:00
summary:
A better fix for asyncio test_stdin_broken_pipe (#7221)
files:
M Lib/test/test_asyncio/test_subprocess.py
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index 235813aa977c..01583376e571 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -218,8 +218,10 @@ def prepare_broken_pipe_test(self):
# the program ends before the stdin can be feeded
create = asyncio.create_subprocess_exec(
- sys.executable, '-c', 'pass',
+ sys.executable,
+ '-c', 'print("hello", flush=True)',
stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
loop=self.loop)
proc = self.loop.run_until_complete(create)
return (proc, large_data)
@@ -228,7 +230,7 @@ def test_stdin_broken_pipe(self):
proc, large_data = self.prepare_broken_pipe_test()
async def write_stdin(proc, data):
- await asyncio.sleep(0.5, loop=self.loop)
+ await proc.stdout.readline()
proc.stdin.write(data)
await proc.stdin.drain()
More information about the Python-checkins
mailing list