MCPcopy
hub / github.com/pytest-dev/pytest / readouterr

Method readouterr

src/_pytest/capture.py:960–975  ·  view source on GitHub ↗

Read and return the captured output so far, resetting the internal buffer. :returns: The captured content as a namedtuple with ``out`` and ``err`` string attributes.

(self)

Source from the content-addressed store, hash-verified

958 self._capture = None
959
960 def readouterr(self) -> CaptureResult[AnyStr]:
961 """Read and return the captured output so far, resetting the internal
962 buffer.
963
964 :returns:
965 The captured content as a namedtuple with ``out`` and ``err``
966 string attributes.
967 """
968 captured_out, captured_err = self._captured_out, self._captured_err
969 if self._capture is not None:
970 out, err = self._capture.readouterr()
971 captured_out += out
972 captured_err += err
973 self._captured_out = self.captureclass.EMPTY_BUFFER
974 self._captured_err = self.captureclass.EMPTY_BUFFER
975 return CaptureResult(captured_out, captured_err)
976
977 def _suspend(self) -> None:
978 """Suspend this fixture's own capturing temporarily."""

Callers 1

capturing_outputFunction · 0.95

Calls 2

CaptureResultClass · 0.85
readouterrMethod · 0.45

Tested by 1

capturing_outputFunction · 0.76