def exceptions_get_logged(self, mock_debug): # Make write_proc_stdin asplode klass = self._mock_stdin_writer() klass.write_proc_stdin.side_effect = OhNoz("oh god why") # Execute with some stdin to trigger that asplode (but skip the # actual bubbled-up raising of it so we can check things out) try: stdin = StringIO("non-empty") self._runner(klass=klass).run(_, in_stream=stdin) except ThreadException: pass # Assert debug() was called w/ expected format # TODO: make the debug call a method on ExceptionHandlingThread, # then make thread class configurable somewhere in Runner, and pass # in a customized ExceptionHandlingThread that has a Mock for that # method? mock_debug.assert_called_with("Encountered exception OhNoz('oh god why',) in thread for 'handle_stdin'") # noqa
def wait(self): raise OhNoz()
def handle_stderr(self, **kwargs): raise OhNoz()
def handle_stdout(self, **kwargs): raise OhNoz()