def _hang_on_full_pipe(self, pty): class Whoops(Exception): pass runner = Local(Context()) # Force runner IO thread-body method to raise an exception to mimic # real world encoding explosions/etc. When bug is present, this # will make the test hang until forcibly terminated. runner.handle_stdout = Mock(side_effect=Whoops, __name__='sigh') # NOTE: both Darwin (10.10) and Linux (Travis' docker image) have # this file. It's plenty large enough to fill most pipe buffers, # which is the triggering behavior. try: runner.run("cat /usr/share/dict/words", pty=pty) except ThreadException as e: eq_(len(e.exceptions), 1) ok_(e.exceptions[0].type is Whoops) else: assert False, "Did not receive expected ThreadException!"