@@ -163,13 +163,14 @@ def test_communicate_ignore_broken_pipe(self):
163163 self .loop .run_until_complete (proc .wait ())
164164
165165 def test_pause_reading (self ):
166+ limit = 10
167+ size = (limit * 2 + 1 )
168+
166169 @asyncio .coroutine
167170 def test_pause_reading ():
168- limit = 100
169-
170171 code = '\n ' .join ((
171172 'import sys' ,
172- 'sys.stdout.write("x" * %s)' % ( limit * 2 + 1 ) ,
173+ 'sys.stdout.write("x" * %s)' % size ,
173174 'sys.stdout.flush()' ,
174175 ))
175176 proc = yield from asyncio .create_subprocess_exec (
@@ -181,17 +182,19 @@ def test_pause_reading():
181182 stdout_transport = proc ._transport .get_pipe_transport (1 )
182183 stdout_transport .pause_reading = mock .Mock ()
183184
184- yield from proc .wait ()
185+ stdout , stderr = yield from proc .communicate ()
185186
186187 # The child process produced more than limit bytes of output,
187188 # the stream reader transport should pause the protocol to not
188189 # allocate too much memory.
189- return stdout_transport . pause_reading . called
190+ return ( stdout , stdout_transport )
190191
191192 # Issue #22685: Ensure that the stream reader pauses the protocol
192193 # when the child process produces too much data
193- called = self .loop .run_until_complete (test_pause_reading ())
194- self .assertTrue (called )
194+ stdout , transport = self .loop .run_until_complete (test_pause_reading ())
195+
196+ self .assertEqual (stdout , b'x' * size )
197+ self .assertTrue (transport .pause_reading .called )
195198
196199
197200if sys .platform != 'win32' :
0 commit comments