]> granicus.if.org Git - python/commitdiff
asyncio: Fix test_stdin_broken_pipe(), drain() is not a coroutine
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 21 Jul 2014 14:23:33 +0000 (16:23 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 21 Jul 2014 14:23:33 +0000 (16:23 +0200)
Lib/test/test_asyncio/test_subprocess.py

index 5425d9bfd5ebdfd7368900d40e45b1a3ee400678..a4e9df2f8edafab5cd61880a318f79c5a8188fe9 100644 (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):