doc/reference: add CollectReport

CollectReport appears in several hooks, so we should document it. It's
runtest equivalent TestReport is already documented.
This commit is contained in:
Ran Benita 2020-06-14 16:02:25 +03:00
parent 5e35c86a37
commit 2a38ca8a0c
2 changed files with 23 additions and 0 deletions

View File

@ -762,6 +762,14 @@ Collector
:members:
:show-inheritance:
CollectReport
~~~~~~~~~~~~~
.. autoclass:: _pytest.runner.CollectReport()
:members:
:show-inheritance:
:inherited-members:
Config
~~~~~~

View File

@ -335,6 +335,8 @@ class TestReport(BaseReport):
class CollectReport(BaseReport):
"""Collection report object."""
when = "collect"
def __init__(
@ -346,11 +348,24 @@ class CollectReport(BaseReport):
sections: Iterable[Tuple[str, str]] = (),
**extra
) -> None:
#: normalized collection node id
self.nodeid = nodeid
#: test outcome, always one of "passed", "failed", "skipped".
self.outcome = outcome
#: None or a failure representation.
self.longrepr = longrepr
#: The collected items and collection nodes.
self.result = result or []
#: list of pairs ``(str, str)`` of extra information which needs to
#: marshallable. Used by pytest to add captured text
#: from ``stdout`` and ``stderr``, but may be used by other plugins
#: to add arbitrary information to reports.
self.sections = list(sections)
self.__dict__.update(extra)
@property