Collector
Test result collector for pytest-agent-digest.
| CLASS | DESCRIPTION |
|---|---|
ReportCollector |
Accumulates the |
TestResult |
Represents a single test outcome captured during a pytest session. |
| FUNCTION | DESCRIPTION |
|---|---|
strip_ansi |
Remove ANSI escape sequences from text. |
Classes¶
ReportCollector
¶
ReportCollector()
Accumulates the TestResult objects while a pytest session runs.
Wire this into pytest_configure (instantiate) and pytest_runtest_logreport (call add) so the renderer can
consume a fully populated collector at the session end.
Initialize with an empty result list.
| METHOD | DESCRIPTION |
|---|---|
add |
Classify report and append a |
| ATTRIBUTE | DESCRIPTION |
|---|---|
counts |
Return a dict of |
has_failures |
Return
TYPE:
|
Attributes¶
counts
property
¶
has_failures
property
¶
has_failures: bool
Return True if any result is "failed" or "xpassed".
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
Functions¶
add
¶
add(report: TestReport) -> None
Classify report and append a TestResult class if it is a call phase.
report.when == "call" reports are stored for normal outcomes.
report.when == "setup" reports are stored only when skipped, because
@pytest.mark.skip raises a Skipped exception during the setup phase
and never produces a call-phase report.
| PARAMETER | DESCRIPTION |
|---|---|
report
|
The pytest test report to classify and store.
TYPE:
|
TestResult
dataclass
¶
TestResult(node_id: str, outcome: str, longrepr: str | None, duration: float, skip_reason: str | None)
Represents a single test outcome captured during a pytest session.
| ATTRIBUTE | DESCRIPTION |
|---|---|
node_id |
The pytest node ID (e.g.
TYPE:
|
outcome |
One of
TYPE:
|
longrepr |
Formatted traceback or reason string, stripped of ANSI codes.
TYPE:
|
duration |
Test duration in seconds.
TYPE:
|
skip_reason |
Human-readable skip reason for skipped tests;
TYPE:
|