def newCaptureBeforeTest(test): old_before_test(test) test_id = self.get_test_id(test) capture_plugin._buf = FlushingStringIO( lambda data: dump_test_stdout(self.messages, test_id, test_id, data)) sys.stdout = capture_plugin._buf
def _setupStdout(self): if getattr(self, 'buffer', None): self._stderr_buffer = FlushingStringIO(self._dump_test_stderr) self._stdout_buffer = FlushingStringIO(self._dump_test_stdout) sys.stdout = self._stdout_buffer sys.stderr = self._stderr_buffer