From 73b07e14393b6fdbacfc304e55c6c08d94be8108 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 11 Jul 2017 21:45:27 -0300 Subject: [PATCH] Add docs for Item.add_report_section in the docs Fix #2381 --- _pytest/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/_pytest/main.py b/_pytest/main.py index 1a6ba2781..2cc15598f 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -518,6 +518,21 @@ class Item(Node): self._report_sections = [] def add_report_section(self, when, key, content): + """ + Adds 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"``, ``"teardown"``. + :param str key: + Name of the section, can be customized at will. Pytest uses ``"stdout"`` and + ``"stderr"`` internally. + + :param str content: + The full contents as a string. + """ if content: self._report_sections.append((when, key, content))