Skip to content

Commit 771cedd

Browse files
Merge pull request #2567 from nicoddemus/add-report-section-docs
Add docs for Item.add_report_section in the docs
2 parents 81cec9f + 73b07e1 commit 771cedd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

_pytest/main.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,21 @@ def __init__(self, name, parent=None, config=None, session=None):
518518
self._report_sections = []
519519

520520
def add_report_section(self, when, key, content):
521+
"""
522+
Adds a new report section, similar to what's done internally to add stdout and
523+
stderr captured output::
524+
525+
item.add_report_section("call", "stdout", "report section contents")
526+
527+
:param str when:
528+
One of the possible capture states, ``"setup"``, ``"call"``, ``"teardown"``.
529+
:param str key:
530+
Name of the section, can be customized at will. Pytest uses ``"stdout"`` and
531+
``"stderr"`` internally.
532+
533+
:param str content:
534+
The full contents as a string.
535+
"""
521536
if content:
522537
self._report_sections.append((when, key, content))
523538

0 commit comments

Comments
 (0)