[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) asyncio: Fix test_stdin_broken_pipe(), drain() is not a coroutine

victor.stinner python-checkins at python.org
Mon Jul 21 16:24:47 CEST 2014


http://hg.python.org/cpython/rev/057a8bd043ea
changeset:   91744:057a8bd043ea
parent:      91742:6b536f0516ea
parent:      91743:cb8fc24e209f
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jul 21 16:23:51 2014 +0200
summary:
  (Merge 3.4) asyncio: Fix test_stdin_broken_pipe(), drain() is not a coroutine

files:
  Lib/test/test_asyncio/test_subprocess.py |  9 +++++++--
  1 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -141,10 +141,15 @@
     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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list