summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-11-28 17:02:16 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-11-28 17:02:16 (GMT)
commitae553eb794cae10de0ece64de096647a8b304137 (patch)
tree8f7d0a755cae2c335bf2e074ddaa2883e9a62fcc /Lib
parent79d784ab7b84b5a441075dd4876bbffa411f3f76 (diff)
parentcbbd04d1769735f6dbb5fd7b204e5ea29f748375 (diff)
downloadcpython-ae553eb794cae10de0ece64de096647a8b304137.zip
cpython-ae553eb794cae10de0ece64de096647a8b304137.tar.gz
cpython-ae553eb794cae10de0ece64de096647a8b304137.tar.bz2
Merge 3.4 (asyncio)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_asyncio/test_subprocess.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index d0ab230..c84078d 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -163,13 +163,14 @@ class SubprocessMixin:
self.loop.run_until_complete(proc.wait())
def test_pause_reading(self):
+ limit = 10
+ size = (limit * 2 + 1)
+
@asyncio.coroutine
def test_pause_reading():
- limit = 100
-
code = '\n'.join((
'import sys',
- 'sys.stdout.write("x" * %s)' % (limit * 2 + 1),
+ 'sys.stdout.write("x" * %s)' % size,
'sys.stdout.flush()',
))
proc = yield from asyncio.create_subprocess_exec(
@@ -181,17 +182,19 @@ class SubprocessMixin:
stdout_transport = proc._transport.get_pipe_transport(1)
stdout_transport.pause_reading = mock.Mock()
- yield from proc.wait()
+ stdout, stderr = yield from proc.communicate()
# The child process produced more than limit bytes of output,
# the stream reader transport should pause the protocol to not
# allocate too much memory.
- return stdout_transport.pause_reading.called
+ return (stdout, stdout_transport)
# Issue #22685: Ensure that the stream reader pauses the protocol
# when the child process produces too much data
- called = self.loop.run_until_complete(test_pause_reading())
- self.assertTrue(called)
+ stdout, transport = self.loop.run_until_complete(test_pause_reading())
+
+ self.assertEqual(stdout, b'x' * size)
+ self.assertTrue(transport.pause_reading.called)
if sys.platform != 'win32':