MCPcopy Create free account
hub / github.com/pytest-dev/pytest / item_capture

Method item_capture

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

Source from the content-addressed store, hash-verified

746
747 @contextlib.contextmanager
748 def item_capture(self, when: str, item: Item) -> Generator[None, None, None]:
749 self.resume_global_capture()
750 self.activate_fixture()
751 try:
752 yield
753 finally:
754 self.deactivate_fixture()
755 self.suspend_global_capture(in_=False)
756
757 out, err = self.read_global_capture()
758 item.add_report_section(when, "stdout", out)
759 item.add_report_section(when, "stderr", err)
760
761 # Hooks
762

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