Collection report object. Reports can contain arbitrary extra attributes.
| 455 | |
| 456 | @final |
| 457 | class CollectReport(BaseReport): |
| 458 | """Collection report object. |
| 459 | |
| 460 | Reports can contain arbitrary extra attributes. |
| 461 | """ |
| 462 | |
| 463 | when = "collect" |
| 464 | |
| 465 | def __init__( |
| 466 | self, |
| 467 | nodeid: str, |
| 468 | outcome: Literal["passed", "failed", "skipped"], |
| 469 | longrepr: None |
| 470 | | ExceptionInfo[BaseException] |
| 471 | | tuple[str, int, str] |
| 472 | | str |
| 473 | | TerminalRepr, |
| 474 | result: list[Item | Collector] | None, |
| 475 | sections: Iterable[tuple[str, str]] = (), |
| 476 | **extra, |
| 477 | ) -> None: |
| 478 | #: Normalized collection nodeid. |
| 479 | self.nodeid = nodeid |
| 480 | |
| 481 | #: Test outcome, always one of "passed", "failed", "skipped". |
| 482 | self.outcome = outcome |
| 483 | |
| 484 | #: None or a failure representation. |
| 485 | self.longrepr = longrepr |
| 486 | |
| 487 | #: The collected items and collection nodes. |
| 488 | self.result = result or [] |
| 489 | |
| 490 | #: Tuples of str ``(heading, content)`` with extra information |
| 491 | #: for the test report. Used by pytest to add text captured |
| 492 | #: from ``stdout``, ``stderr``, and intercepted logging events. May |
| 493 | #: be used by other plugins to add arbitrary information to reports. |
| 494 | self.sections = list(sections) |
| 495 | |
| 496 | self.__dict__.update(extra) |
| 497 | |
| 498 | @property |
| 499 | def location( # type:ignore[override] |
| 500 | self, |
| 501 | ) -> tuple[str, int | None, str] | None: |
| 502 | return (self.fspath, None, self.fspath) |
| 503 | |
| 504 | def __repr__(self) -> str: |
| 505 | return f"<CollectReport {self.nodeid!r} lenresult={len(self.result)} outcome={self.outcome!r}>" |
| 506 | |
| 507 | |
| 508 | class CollectErrorRepr(TerminalRepr): |
no outgoing calls
no test coverage detected