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

Method item_capture

src/_pytest/capture.py:858–869  ·  view source on GitHub ↗
(self, when: str, item: Item)

Source from the content-addressed store, hash-verified

856
857 @contextlib.contextmanager
858 def item_capture(self, when: str, item: Item) -> Generator[None]:
859 self.resume_global_capture()
860 self.activate_fixture()
861 try:
862 yield
863 finally:
864 self.deactivate_fixture()
865 self.suspend_global_capture(in_=False)
866
867 out, err = self.read_global_capture()
868 item.add_report_section(when, "stdout", out)
869 item.add_report_section(when, "stderr", err)
870
871 # Hooks
872

Callers 3

pytest_runtest_setupMethod · 0.95
pytest_runtest_callMethod · 0.95

Calls 6

resume_global_captureMethod · 0.95
activate_fixtureMethod · 0.95
deactivate_fixtureMethod · 0.95
read_global_captureMethod · 0.95
add_report_sectionMethod · 0.80

Tested by

no test coverage detected