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

Method close

src/_pytest/capture.py:945–958  ·  src/_pytest/capture.py::CaptureFixture.close
(self)

Source from the content-addressed store, hash-verified

943 self._capture.start_capturing()
944
945 def close(self) -> None:
946 if self._capture is not None:
947 if self._config.get(class="st">"tee"):
948 class="cm"># When tee is enabled, output was already written to the
949 class="cm"># original stream in real-time by TeeCaptureIO. Using
950 class="cm"># pop_outerr_to_orig() would write it a second time via
951 class="cm"># writeorg(), causing doubled output (see #13784).
952 out, err = self._capture.readouterr()
953 else:
954 out, err = self._capture.pop_outerr_to_orig()
955 self._captured_out += out
956 self._captured_err += err
957 self._capture.stop_capturing()
958 self._capture = None
959
960 def readouterr(self) -> CaptureResult[AnyStr]:
961 class="st">"""Read and return the captured output so far, resetting the internal

Callers 15

capturing_outputFunction · 0.95
capsysFunction · 0.95
capteesysFunction · 0.95
capsysbinaryFunction · 0.95
capfdFunction · 0.95
capfdbinaryFunction · 0.95
__exit__Method · 0.45
pytest_unconfigureFunction · 0.45
set_log_pathMethod · 0.45
pytest_unconfigureMethod · 0.45
create_cleanup_lockFunction · 0.45
popenMethod · 0.45

Calls 4

pop_outerr_to_origMethod · 0.80
stop_capturingMethod · 0.80
getMethod · 0.45
readouterrMethod · 0.45

Tested by 15

capturing_outputFunction · 0.76
__exit__Method · 0.36
popenMethod · 0.36
runMethod · 0.36
test_zipfileMethod · 0.36
test_textMethod · 0.36
test_textMethod · 0.36
tmpfileFunction · 0.36
saved_fdFunction · 0.36