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

Method add_report_section

src/_pytest/nodes.py:723–738  ·  view source on GitHub ↗

Add a new report section, similar to what's done internally to add stdout and stderr captured output:: item.add_report_section("call", "stdout", "report section contents") :param str when: One of the possible capture states, ``"setup"``, ``"call"``, ``"teard

(self, when: str, key: str, content: str)

Source from the content-addressed store, hash-verified

721 raise NotImplementedError("runtest must be implemented by Item subclass")
722
723 def add_report_section(self, when: str, key: str, content: str) -> None:
724 """Add a new report section, similar to what's done internally to add
725 stdout and stderr captured output::
726
727 item.add_report_section("call", "stdout", "report section contents")
728
729 :param str when:
730 One of the possible capture states, ``"setup"``, ``"call"``, ``"teardown"``.
731 :param str key:
732 Name of the section, can be customized at will. Pytest uses ``"stdout"`` and
733 ``"stderr"`` internally.
734 :param str content:
735 The full contents as a string.
736 """
737 if content:
738 self._report_sections.append((when, key, content))
739
740 def reportinfo(self) -> tuple[os.PathLike[str] | str, int | None, str]:
741 """Get location information for this item for test reports.

Callers 2

_runtest_forMethod · 0.80
item_captureMethod · 0.80

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected