Output schemas¶
Generated field references and full JSON Schemas (draft-07) for the rstest JSON outputs that are built from typed Rust structs.
This list is partial. Outputs still assembled by hand, and so not covered
here yet, include streaming JSON (--output json / --stream-json),
--cov-diff-json, and the meta.projects map a monorepo root adds to the
run report. Those are documented in prose in
Report JSON and the CLI reference.
Everything on this page is generated from the Rust types that produce the
output. A golden test in the build regenerates these artifacts and fails CI
if a covered type changes without the docs being refreshed
(RSTEST_BLESS_SCHEMAS=1 cargo test -p rstest-cli schema), so the covered
schemas track the code. The guarantee applies only to what the typed struct
describes: a field added outside the struct, or an output assembled from
serde_json::json!, is not checked.
Each versioned output carries a schema integer; incompatible changes bump
it. The flake log is an unversioned cache file.
For worked examples, the conditions under which each doctor section is
present, and version history, see the prose walkthrough:
Report JSON: Doctor JSON. For the run
snapshot's prose walkthrough and examples, see Shape.
Run report¶
Source: --report-json
The --report-json document (schema 5). Fields are declared alphabetically to match the historical output; borrows the run's data so the writer and the HTML embed serialize the same source without cloning.
| Field | Type | Required | Description |
|---|---|---|---|
collect_error_reprs |
object of string | no | Each collect error's traceback, keyed by its collect_errors path, including <session: ...> errors that escaped the whole session. Absent when there are none. |
collect_errors |
array of string | yes | Paths of collectors that failed to import/collect. |
failure_groups |
array of FailureGroup | no | Failures that share a cause (same exception, message and project frame), largest group first. Only groups of two or more; absent when there are none. |
meta |
SnapshotMeta | yes | Run metadata: argv, counts, exit status, schema version, shard. |
tests |
object of TestEntry | yes | Per-test outcomes, keyed by node id. |
FailureGroup¶
Failures with one cause: the same exception type, message (numbers and addresses masked) and deepest project frame.
| Field | Type | Required | Description |
|---|---|---|---|
at |
string or null | yes | path:line of the deepest traceback frame in project code, or null when every frame was outside the project. |
count |
integer | yes | Number of failed tests in the group. |
exception |
string | yes | Exception type name. |
message |
string | yes | The first member's exception message (first line). |
nodeids |
array of string | yes | The failed tests, sorted. |
ShardJson¶
Sharding identity block (only under --shard).
| Field | Type | Required | Description |
|---|---|---|---|
budget_skipped |
array of string | no | Tests in this shard's bucket that --budget left out, so shard-verify counts them as covered rather than dropped. |
collection_hash |
string | yes | sha256 of the full ordered nodeid list (identical across shards). |
collection_size |
integer | yes | Number of collected nodeids. |
k |
integer | yes | This shard's index (1-based). |
n |
integer | yes | Total shard count. |
SnapshotMeta¶
Run-level envelope for the report document.
| Field | Type | Required | Description |
|---|---|---|---|
argv |
array of string | yes | The process argv the run was invoked with. |
counts |
object of integer | yes | Outcome counts (pytest accounting); all keys always present. |
duration_seconds |
number | yes | Wall-clock run duration, rounded to two decimals. |
exitstatus |
integer | yes | Test-session exit status, recorded before the post-run gates (--fail-on-leak, --durations-regress, --doctor-fail-on, --cov-fail-under, --cov-diff-fail-under) can raise the process exit to 1. |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
shard |
ShardJson | no | Sharding identity; present only under --shard K/N. |
started_at_epoch |
integer | yes | Unix epoch (seconds) the run started. |
warm_template |
WarmTemplateJson or null | no | The --fork-pool=app warm template this run's workers were forked from; present only when one imported the app this run. |
workers |
integer | yes | Worker count for the run (-n). |
TestEntry¶
Per-test phase outcomes, mirroring the compat-harness recorder schema (rstest-research/harness/recorder.py) so diff_snapshots.py can gate rstest output directly against pytest baselines.
| Field | Type | Required | Description |
|---|---|---|---|
cached |
boolean | no | Not executed this run: unchanged since the last green run, so its prior pass was carried forward (--incremental). Still counts as passed. |
call |
string | no | Call-phase outcome: "passed", "failed" or "skipped". Absent when the test was skipped at setup; an xfail test records "skipped" with wasxfail. |
cpu |
number | no | Call-phase CPU time (process_time plus reaped child processes), present only when measured (--doctor or a live-stream run). Serialized when present so a report-json consumer can spot wait-bound tests (wall ≫ cpu); omitted on a plain run so the snapshot stays byte-comparable to the pytest baseline. |
crashed |
boolean | no | The outcome was fabricated because the worker died on this test (crash or --worker-timeout kill), or the test was running when SIGINT/SIGTERM stopped the run; not produced by pytest. |
duration |
number | no | Call-phase wall time in seconds, 4 decimal places. |
flaky |
boolean | no | Passed only after one or more reruns (--reruns or @pytest.mark.flaky). |
lineno |
integer | no | Source line of the test (0-based, from pytest's report.location), for editor mapping. Absent when pytest reports no location. |
longrepr |
string | no | Failure text (assertion repr / traceback), failures only. |
quarantined |
boolean | no | Failed, but matched the --quarantine list or the --auto-quarantine set: reported distinctly, never fatal to the run. |
setup |
string | no | Setup-phase outcome: "passed", "failed" or "skipped". |
skip_reason |
string | no | pytest's skip message (first 200 characters), keeping its Skipped: prefix. |
subtests_failed |
integer | no | Failed subtests (unittest subTest / the subtests fixture). Any makes call "failed"; each also counts as one failed, as in pytest. |
teardown |
string | no | Teardown-phase outcome: "passed", "failed" or "skipped". |
wasxfail |
boolean | no | true when the test was an expected failure (xfail or xpass); absent otherwise. |
worker |
string | no | Worker that produced the final outcome (pool runs only). |
WarmTemplateJson¶
meta.warm_template: what the --fork-pool=app template imported.
| Field | Type | Required | Description |
|---|---|---|---|
denied |
integer | yes | Modules on the warm manifest's deny list: imported per worker instead. |
import_seconds |
number | yes | Wall time of the template's imports, in seconds (two decimals). |
modules |
integer | yes | Modules the template imported before forking the workers. |
Run report: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Snapshot",
"description": "The `--report-json` document (schema 5). Fields are declared alphabetically\nto match the historical output; borrows the run's data so the writer and the\nHTML embed serialize the same source without cloning.",
"type": "object",
"properties": {
"collect_error_reprs": {
"description": "Each collect error's traceback, keyed by its `collect_errors` path,\nincluding `<session: ...>` errors that escaped the whole session.\nAbsent when there are none.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"collect_errors": {
"description": "Paths of collectors that failed to import/collect.",
"type": "array",
"items": {
"type": "string"
}
},
"failure_groups": {
"description": "Failures that share a cause (same exception, message and project\nframe), largest group first. Only groups of two or more; absent when\nthere are none.",
"type": "array",
"items": {
"$ref": "#/definitions/FailureGroup"
}
},
"meta": {
"description": "Run metadata: argv, counts, exit status, schema version, shard.",
"allOf": [
{
"$ref": "#/definitions/SnapshotMeta"
}
]
},
"tests": {
"description": "Per-test outcomes, keyed by node id.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/TestEntry"
}
}
},
"required": [
"collect_errors",
"meta",
"tests"
],
"definitions": {
"FailureGroup": {
"description": "Failures with one cause: the same exception type, message (numbers and\naddresses masked) and deepest project frame.",
"type": "object",
"properties": {
"at": {
"description": "`path:line` of the deepest traceback frame in project code, or null\nwhen every frame was outside the project.",
"type": [
"string",
"null"
]
},
"count": {
"description": "Number of failed tests in the group.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"exception": {
"description": "Exception type name.",
"type": "string"
},
"message": {
"description": "The first member's exception message (first line).",
"type": "string"
},
"nodeids": {
"description": "The failed tests, sorted.",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"exception",
"message",
"at",
"count",
"nodeids"
]
},
"ShardJson": {
"description": "Sharding identity block (only under `--shard`).",
"type": "object",
"properties": {
"budget_skipped": {
"description": "Tests in this shard's bucket that `--budget` left out, so\n`shard-verify` counts them as covered rather than dropped.",
"type": "array",
"items": {
"type": "string"
}
},
"collection_hash": {
"description": "sha256 of the full ordered nodeid list (identical across shards).",
"type": "string"
},
"collection_size": {
"description": "Number of collected nodeids.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"k": {
"description": "This shard's index (1-based).",
"type": "integer",
"format": "uint",
"minimum": 0
},
"n": {
"description": "Total shard count.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"collection_hash",
"collection_size",
"k",
"n"
]
},
"SnapshotMeta": {
"description": "Run-level envelope for the report document.",
"type": "object",
"properties": {
"argv": {
"description": "The process argv the run was invoked with.",
"type": "array",
"items": {
"type": "string"
}
},
"counts": {
"description": "Outcome counts (pytest accounting); all keys always present.",
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "uint64",
"minimum": 0
}
},
"duration_seconds": {
"description": "Wall-clock run duration, rounded to two decimals.",
"type": "number",
"format": "double"
},
"exitstatus": {
"description": "Test-session exit status, recorded before the post-run gates\n(`--fail-on-leak`, `--durations-regress`, `--doctor-fail-on`,\n`--cov-fail-under`, `--cov-diff-fail-under`) can raise the process\nexit to 1.",
"type": "integer",
"format": "int32"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"shard": {
"description": "Sharding identity; present only under `--shard K/N`.",
"allOf": [
{
"$ref": "#/definitions/ShardJson"
}
]
},
"started_at_epoch": {
"description": "Unix epoch (seconds) the run started.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"warm_template": {
"description": "The `--fork-pool=app` warm template this run's workers were forked\nfrom; present only when one imported the app this run.",
"anyOf": [
{
"$ref": "#/definitions/WarmTemplateJson"
},
{
"type": "null"
}
]
},
"workers": {
"description": "Worker count for the run (`-n`).",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"argv",
"counts",
"duration_seconds",
"exitstatus",
"runner",
"schema",
"started_at_epoch",
"workers"
]
},
"TestEntry": {
"description": "Per-test phase outcomes, mirroring the compat-harness recorder schema\n(rstest-research/harness/recorder.py) so `diff_snapshots.py` can gate\nrstest output directly against pytest baselines.",
"type": "object",
"properties": {
"cached": {
"description": "Not executed this run: unchanged since the last green run, so its prior\npass was carried forward (`--incremental`). Still counts as passed.",
"type": "boolean"
},
"call": {
"description": "Call-phase outcome: `\"passed\"`, `\"failed\"` or `\"skipped\"`. Absent when\nthe test was skipped at setup; an xfail test records `\"skipped\"` with\n`wasxfail`.",
"type": "string"
},
"cpu": {
"description": "Call-phase CPU time (process_time plus reaped child processes), present\nonly when measured (`--doctor` or a live-stream run). Serialized when\npresent so a report-json consumer can spot wait-bound tests (wall ≫\ncpu); omitted on a plain run so the snapshot stays byte-comparable to\nthe pytest baseline.",
"type": "number",
"format": "double"
},
"crashed": {
"description": "The outcome was fabricated because the worker died on this test\n(crash or --worker-timeout kill), or the test was running when\nSIGINT/SIGTERM stopped the run; not produced by pytest.",
"type": "boolean"
},
"duration": {
"description": "Call-phase wall time in seconds, 4 decimal places.",
"type": "number",
"format": "double"
},
"flaky": {
"description": "Passed only after one or more reruns (--reruns or @pytest.mark.flaky).",
"type": "boolean"
},
"lineno": {
"description": "Source line of the test (0-based, from pytest's report.location),\nfor editor mapping. Absent when pytest reports no location.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"longrepr": {
"description": "Failure text (assertion repr / traceback), failures only.",
"type": "string"
},
"quarantined": {
"description": "Failed, but matched the --quarantine list or the --auto-quarantine\nset: reported distinctly, never fatal to the run.",
"type": "boolean"
},
"setup": {
"description": "Setup-phase outcome: `\"passed\"`, `\"failed\"` or `\"skipped\"`.",
"type": "string"
},
"skip_reason": {
"description": "pytest's skip message (first 200 characters), keeping its `Skipped: `\nprefix.",
"type": "string"
},
"subtests_failed": {
"description": "Failed subtests (unittest `subTest` / the `subtests` fixture). Any\nmakes `call` \"failed\"; each also counts as one `failed`, as in pytest.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"teardown": {
"description": "Teardown-phase outcome: `\"passed\"`, `\"failed\"` or `\"skipped\"`.",
"type": "string"
},
"wasxfail": {
"description": "`true` when the test was an expected failure (xfail or xpass); absent\notherwise.",
"type": "boolean"
},
"worker": {
"description": "Worker that produced the final outcome (pool runs only).",
"type": "string"
}
}
},
"WarmTemplateJson": {
"description": "`meta.warm_template`: what the `--fork-pool=app` template imported.",
"type": "object",
"properties": {
"denied": {
"description": "Modules on the warm manifest's deny list: imported per worker instead.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"import_seconds": {
"description": "Wall time of the template's imports, in seconds (two decimals).",
"type": "number",
"format": "double"
},
"modules": {
"description": "Modules the template imported before forking the workers.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"denied",
"import_seconds",
"modules"
]
}
}
}
Doctor report¶
Source: --doctor-json
| Field | Type | Required | Description |
|---|---|---|---|
coverage_waste |
CoverageWaste or null | yes | Slow tests whose every covered line is also covered by another test - delete/merge candidates. None unless a per-test coverage index was warm (--cov --cov-context=test) and at least one test qualified. |
cpu_time_seconds |
number | yes | Sum of whole-protocol CPU time (the worker process plus child processes it waited for), over tests where it was measured. |
drift |
Drift or null | yes | Tests whose typical call time crept up across their recorded runs, in steps too small for --durations-regress. null unless one did. |
fixture_grouping |
FixtureGrouping or null | yes | Modules and classes --dist load kept on one worker for their fixture setup cost. null when the run grouped none (lazy collection, --shuffle, --order fail-fast, one worker, or no costly scope). |
fixtures |
array of FixtureEntry | yes | Fixture setup cost summed across all workers, costliest first (top 50). |
fork_prewarm |
boolean | yes | Whether this run already used --fork-pool (Unix fork-prewarm). Gates the "try --fork-pool" hint so it isn't suggested when already on. |
leaks |
array of Leak | no | Tests that leaked threads / fds (created by the test, still open after its teardown). Empty unless leak-check instrumentation ran (--doctor / --fail-on-leak). |
network |
NetworkAccess or null | yes | Tests that opened outbound network connections (outside loopback and [tool.rstest] network-allow). null when none did. |
parallel_efficiency |
ParallelEfficiency or null | yes | Realized speedup and worker load balance; present only on multi-worker pool runs. |
parallel_floor |
ParallelFloor or null | yes | Present only when the longest test outlasts both a worker's even share of the test time and 1 second, plus 10%: no worker count can finish faster than that test. |
rstest_version |
string | yes | The rstest version that wrote the report. |
schema |
integer | yes | Document schema version, bumped when the shape changes incompatibly. |
slowest_files |
array of FileEntry | yes | Test time per file, slowest first (top 20). |
startup_seconds |
number | yes | Wall from pool spawn to every worker's first event (imported core + started collecting), part of wall_seconds. A fixed per-run tax that --fork-pool (Unix) cuts at high -n; 0.0 on single-worker runs. Surfaced so a startup-bound suite is legible. |
test_time_seconds |
number | yes | Sum of each test's whole protocol (setup + call + teardown), so time spent in function fixtures counts. |
tests |
integer | yes | Tests with a recorded call duration (tests skipped before their call phase drop out): the population every time figure is computed over. |
timeouts |
TimeoutAdvice or null | yes | Suggested --timeout and per-test @pytest.mark.timeout overrides, from each test's slowest recorded passing run (call phase). null until some test in this run has 5 passing runs in the run history. |
wait_bound |
WaitBound or null | yes | Present only when waiting is a notable share (>= 20% and >= 1s); --doctor-fail-on gates wait_* on the measured values regardless. |
wall_seconds |
number | yes | Wall-clock time of the whole run, in seconds. |
workers |
integer | yes | Workers that ran tests: 1 for a single-worker (-n 0 / -n 1) run. |
CoverageWaste¶
Slow tests that add no unique coverage: every line each one executes is also executed by some other test, so it can be deleted or merged without dropping any covered line. Pure suite bloat on the time axis.
| Field | Type | Required | Description |
|---|---|---|---|
redundant_tests |
integer | yes | Count of redundant slow tests found (tests shows the slowest of them). |
tests |
array of WasteTest | yes | The slowest redundant tests, worst first (capped). |
wasted_seconds |
number | yes | Sum of the durations of every redundant slow test (not just the shown ones) - the time reclaimable by pruning them. |
Drift¶
Slow creep: a test whose median call time rose from the older third of its recorded passing runs to the middle third to the newest, by at least 1.5x and 0.2s overall.
| Field | Type | Required | Description |
|---|---|---|---|
drifting_tests |
integer | yes | Tests in this run that drift. |
tests |
array of DriftTest | yes | The largest rises, worst first (top 10). |
DriftTest¶
| Field | Type | Required | Description |
|---|---|---|---|
middle_median |
number | yes | Median over the middle third. |
newer_median |
number | yes | Median over the newest third. |
nodeid |
string | yes | The test. |
older_median |
number | yes | Median call-phase seconds over the oldest third of its passing runs. |
runs |
integer | yes | Passing runs the medians come from. |
FileEntry¶
| Field | Type | Required | Description |
|---|---|---|---|
file |
string | yes | Test file, the path part of its tests' nodeids. |
pct |
number | yes | total_seconds as a percentage of test_time_seconds. |
total_seconds |
number | yes | Summed whole-protocol time of the file's tests, in seconds. |
FixtureEntry¶
| Field | Type | Required | Description |
|---|---|---|---|
constant |
boolean | no | Scope-promotion advisor: a function-scoped fixture that produced the same immutable builtin value on every call in every worker, with no per-test teardown or narrower-scoped inputs (checked worker-side), a candidate for @pytest.fixture(scope="session"). |
count |
integer | yes | Setups across all workers. |
name |
string | yes | Fixture name. |
projected_saving_seconds |
number | no | Projected wall-time saved by promoting this candidate to session scope: the largest per-worker-session (calls - 1) * mean_setup, i.e. the redundant re-setups removed on the worker that benefits most. 0 unless constant. |
scope |
string | yes | pytest scope: function, class, module, package or session. |
total_seconds |
number | yes | Setup time summed across all workers, in seconds. |
FixtureGrouping¶
What fixture-cost-aware dispatch saved: each module or class it kept on one worker, its setups this run, and how many plain chunked dispatch would have caused (an estimate from the chunk size and worker count).
| Field | Type | Required | Description |
|---|---|---|---|
groups |
array of GroupEntry | yes | Every group, most saved first. |
saved_seconds |
number | yes | Setup seconds saved over every group, against plain chunked dispatch. |
GateTest¶
| Field | Type | Required | Description |
|---|---|---|---|
duration |
number | yes | Its whole-protocol time (setup + call + teardown), in seconds. |
nodeid |
string | yes | The test that gates the wall time. |
GroupEntry¶
| Field | Type | Required | Description |
|---|---|---|---|
chunked_setups |
integer | yes | About how many times plain chunked dispatch would have set them up. |
saved_seconds |
number | yes | (chunked_setups - setups) * setup_seconds, never negative. |
scope |
string | yes | The module's or class's nodeid. |
setup_seconds |
number | yes | One setup's recorded seconds. |
setups |
integer | yes | Times its module/class fixtures were set up this run. |
tests |
integer | yes | Tests in it this run dispatched. |
Leak¶
A test that ended with more threads / open fds than it started: a resource it opened and never released (its own teardown included). Or a class, module or package fixture whose resources outlived its scope end in at least two of its setups (scope set).
| Field | Type | Required | Description |
|---|---|---|---|
fds |
integer | yes | Fds the test opened that are still open after its teardown (0 if only threads leaked). |
nodeid |
string | yes | The test that leaked, or the fixture (baseid::name) when scope is set. |
scope |
string or null | no | The fixture's scope (class, module, package); absent for a test. |
threads |
integer | yes | Threads the test created that outlived its teardown (0 if only fds leaked). |
NetworkAccess¶
Tests that reached the network, from the worker's network guard.
| Field | Type | Required | Description |
|---|---|---|---|
tests |
array of NetworkTest | yes | Those tests, most destinations first (top 20). |
tests_with_network |
integer | yes | Tests that connected outside loopback and the allowlist. |
NetworkTest¶
| Field | Type | Required | Description |
|---|---|---|---|
destinations |
array of string | yes | Destinations it connected to, as host:port (with the IP when it was resolved from a name). |
nodeid |
string | yes | The test. |
ParallelEfficiency¶
Realized parallel speedup measured from an actual run. Unlike ParallelFloor (a static pre-run estimate), this is the after-the-fact "why isn't -n auto faster?". Only for multi-worker pool runs.
| Field | Type | Required | Description |
|---|---|---|---|
efficiency_pct |
number | yes | 100 * realized / ideal: how busy the workers were, up to 100%. |
ideal_speedup |
integer | yes | Worker count (-n) - the ceiling for a purely CPU-bound suite. |
imbalance_pct |
number | yes | 100 * (busiest - idlest) / busiest. High = uneven distribution. |
long_pole_seconds |
number | yes | Slowest single test (setup + call + teardown): the hard floor no worker count beats. |
realized_speedup |
number | yes | test_time / wall. At most ideal_speedup, since each worker runs one test at a time; a wait-bound suite run with -n above the core count can realize more than the core count. |
workers_busy |
array of WorkerLoad | yes | Busy time summed per worker, descending - the load-balance picture. |
ParallelFloor¶
| Field | Type | Required | Description |
|---|---|---|---|
gate_tests |
array of GateTest | yes | The tests that exceed the floor, longest first (at most 10). |
ideal_share_seconds |
number | yes | A worker's even share of the test time (test_time_seconds / workers), in seconds. |
longest_seconds |
number | yes | The longest single test (setup + call + teardown), in seconds. |
TimeoutAdvice¶
Timeouts that catch a hang without killing a slow-but-healthy test. Each test's own limit is the larger of 3x its slowest recorded passing run and that run plus 1s, rounded up to whole seconds.
| Field | Type | Required | Description |
|---|---|---|---|
marker_covered |
integer | yes | Tests that would need one but already carry a @pytest.mark.timeout at least as high; not in override_count. |
override_count |
integer | yes | Judged tests whose own limit is above suite_timeout: they need a per-test @pytest.mark.timeout. |
overrides |
array of TimeoutOverride | yes | The highest of those, worst first (top 20). |
suite_timeout |
integer | yes | Suggested suite-wide --timeout, in seconds: the limit that covers 95% of the judged tests. |
tests_judged |
integer | yes | Tests in this run with at least 5 passing runs in the history. |
TimeoutOverride¶
| Field | Type | Required | Description |
|---|---|---|---|
current |
number or null | no | Its current @pytest.mark.timeout, below the suggestion; absent when it has none. |
nodeid |
string | yes | The test. |
runs |
integer | yes | Passing runs that slowest time comes from. |
slowest_seconds |
number | yes | Its slowest recorded passing call-phase time, in seconds (the phase --timeout limits; fixture setup/teardown not included). |
timeout |
integer | yes | Its suggested @pytest.mark.timeout, in seconds. |
WaitBound¶
| Field | Type | Required | Description |
|---|---|---|---|
tests |
array of WaitTest | yes | The biggest waiters, most waiting first (top 50): tests of at least 0.2s that spent 60% or more of their time waiting. |
wait_pct |
number | yes | wait_seconds as a percentage of test_time_seconds. |
wait_seconds |
number | yes | Test time spent waiting rather than on CPU (test_time_seconds - cpu_time_seconds). |
WaitTest¶
| Field | Type | Required | Description |
|---|---|---|---|
duration |
number | yes | Its whole-protocol time (setup + call + teardown), in seconds. |
nodeid |
string | yes | The waiting test. |
wait |
number | yes | The part of duration not spent on CPU, in seconds. |
WasteTest¶
| Field | Type | Required | Description |
|---|---|---|---|
also_covered_by |
integer | yes | Distinct OTHER tests that between them also cover those lines. |
covered_lines |
integer | yes | Lines this test covered, all shared with at least one other test. |
duration |
number | yes | Its whole-protocol time (setup + call + teardown), in seconds. |
nodeid |
string | yes | The redundant test. |
WorkerLoad¶
| Field | Type | Required | Description |
|---|---|---|---|
busy_seconds |
number | yes | Test time this worker spent running tests, in seconds. |
tests |
integer | yes | Tests this worker ran. |
worker |
string | yes | Worker id (gw0, gw1, ...), or serial for tests with no recorded worker. |
Doctor report: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DoctorReport",
"type": "object",
"properties": {
"coverage_waste": {
"description": "Slow tests whose every covered line is also covered by another test -\ndelete/merge candidates. `None` unless a per-test coverage index was\nwarm (`--cov --cov-context=test`) and at least one test qualified.",
"anyOf": [
{
"$ref": "#/definitions/CoverageWaste"
},
{
"type": "null"
}
]
},
"cpu_time_seconds": {
"description": "Sum of whole-protocol CPU time (the worker process plus child processes\nit waited for), over tests where it was measured.",
"type": "number",
"format": "double"
},
"drift": {
"description": "Tests whose typical call time crept up across their recorded runs, in\nsteps too small for `--durations-regress`. `null` unless one did.",
"anyOf": [
{
"$ref": "#/definitions/Drift"
},
{
"type": "null"
}
]
},
"fixture_grouping": {
"description": "Modules and classes `--dist load` kept on one worker for their fixture\nsetup cost. `null` when the run grouped none (lazy collection,\n`--shuffle`, `--order fail-fast`, one worker, or no costly scope).",
"anyOf": [
{
"$ref": "#/definitions/FixtureGrouping"
},
{
"type": "null"
}
]
},
"fixtures": {
"description": "Fixture setup cost summed across all workers, costliest first (top 50).",
"type": "array",
"items": {
"$ref": "#/definitions/FixtureEntry"
}
},
"fork_prewarm": {
"description": "Whether this run already used `--fork-pool` (Unix fork-prewarm). Gates\nthe \"try --fork-pool\" hint so it isn't suggested when already on.",
"type": "boolean"
},
"leaks": {
"description": "Tests that leaked threads / fds (created by the test, still open after\nits teardown). Empty\nunless leak-check instrumentation ran (`--doctor` / `--fail-on-leak`).",
"type": "array",
"items": {
"$ref": "#/definitions/Leak"
}
},
"network": {
"description": "Tests that opened outbound network connections (outside loopback and\n`[tool.rstest] network-allow`). `null` when none did.",
"anyOf": [
{
"$ref": "#/definitions/NetworkAccess"
},
{
"type": "null"
}
]
},
"parallel_efficiency": {
"description": "Realized speedup and worker load balance; present only on multi-worker\npool runs.",
"anyOf": [
{
"$ref": "#/definitions/ParallelEfficiency"
},
{
"type": "null"
}
]
},
"parallel_floor": {
"description": "Present only when the longest test outlasts both a worker's even share\nof the test time and 1 second, plus 10%: no worker count can finish\nfaster than that test.",
"anyOf": [
{
"$ref": "#/definitions/ParallelFloor"
},
{
"type": "null"
}
]
},
"rstest_version": {
"description": "The rstest version that wrote the report.",
"type": "string"
},
"schema": {
"description": "Document schema version, bumped when the shape changes incompatibly.",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"slowest_files": {
"description": "Test time per file, slowest first (top 20).",
"type": "array",
"items": {
"$ref": "#/definitions/FileEntry"
}
},
"startup_seconds": {
"description": "Wall from pool spawn to every worker's first event (imported core +\nstarted collecting), part of `wall_seconds`. A fixed per-run tax that\n`--fork-pool` (Unix) cuts at high `-n`; 0.0 on single-worker runs.\nSurfaced so a startup-bound suite is legible.",
"type": "number",
"format": "double"
},
"test_time_seconds": {
"description": "Sum of each test's whole protocol (setup + call + teardown), so time\nspent in function fixtures counts.",
"type": "number",
"format": "double"
},
"tests": {
"description": "Tests with a recorded call duration (tests skipped before their call\nphase drop out): the population every time figure is computed over.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"timeouts": {
"description": "Suggested `--timeout` and per-test `@pytest.mark.timeout` overrides,\nfrom each test's slowest recorded passing run (call phase). `null`\nuntil some test in this run has 5 passing runs in the run history.",
"anyOf": [
{
"$ref": "#/definitions/TimeoutAdvice"
},
{
"type": "null"
}
]
},
"wait_bound": {
"description": "Present only when waiting is a notable share (>= 20% and >= 1s);\n`--doctor-fail-on` gates `wait_*` on the measured values regardless.",
"anyOf": [
{
"$ref": "#/definitions/WaitBound"
},
{
"type": "null"
}
]
},
"wall_seconds": {
"description": "Wall-clock time of the whole run, in seconds.",
"type": "number",
"format": "double"
},
"workers": {
"description": "Workers that ran tests: 1 for a single-worker (`-n 0` / `-n 1`) run.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"schema",
"rstest_version",
"workers",
"wall_seconds",
"startup_seconds",
"fork_prewarm",
"tests",
"test_time_seconds",
"cpu_time_seconds",
"wait_bound",
"parallel_floor",
"parallel_efficiency",
"fixtures",
"fixture_grouping",
"slowest_files",
"coverage_waste",
"timeouts",
"drift",
"network"
],
"definitions": {
"CoverageWaste": {
"description": "Slow tests that add no unique coverage: every line each one executes is also\nexecuted by some other test, so it can be deleted or merged without dropping\nany covered line. Pure suite bloat on the time axis.",
"type": "object",
"properties": {
"redundant_tests": {
"description": "Count of redundant slow tests found (`tests` shows the slowest of them).",
"type": "integer",
"format": "uint",
"minimum": 0
},
"tests": {
"description": "The slowest redundant tests, worst first (capped).",
"type": "array",
"items": {
"$ref": "#/definitions/WasteTest"
}
},
"wasted_seconds": {
"description": "Sum of the durations of every redundant slow test (not just the shown\nones) - the time reclaimable by pruning them.",
"type": "number",
"format": "double"
}
},
"required": [
"wasted_seconds",
"redundant_tests",
"tests"
]
},
"Drift": {
"description": "Slow creep: a test whose median call time rose from the older third of\nits recorded passing runs to the middle third to the newest, by at least\n1.5x and 0.2s overall.",
"type": "object",
"properties": {
"drifting_tests": {
"description": "Tests in this run that drift.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"tests": {
"description": "The largest rises, worst first (top 10).",
"type": "array",
"items": {
"$ref": "#/definitions/DriftTest"
}
}
},
"required": [
"drifting_tests",
"tests"
]
},
"DriftTest": {
"type": "object",
"properties": {
"middle_median": {
"description": "Median over the middle third.",
"type": "number",
"format": "double"
},
"newer_median": {
"description": "Median over the newest third.",
"type": "number",
"format": "double"
},
"nodeid": {
"description": "The test.",
"type": "string"
},
"older_median": {
"description": "Median call-phase seconds over the oldest third of its passing runs.",
"type": "number",
"format": "double"
},
"runs": {
"description": "Passing runs the medians come from.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"nodeid",
"older_median",
"middle_median",
"newer_median",
"runs"
]
},
"FileEntry": {
"type": "object",
"properties": {
"file": {
"description": "Test file, the path part of its tests' nodeids.",
"type": "string"
},
"pct": {
"description": "`total_seconds` as a percentage of `test_time_seconds`.",
"type": "number",
"format": "double"
},
"total_seconds": {
"description": "Summed whole-protocol time of the file's tests, in seconds.",
"type": "number",
"format": "double"
}
},
"required": [
"file",
"total_seconds",
"pct"
]
},
"FixtureEntry": {
"type": "object",
"properties": {
"constant": {
"description": "Scope-promotion advisor: a function-scoped fixture that produced the\nsame immutable builtin value on every call in every worker, with no\nper-test teardown or narrower-scoped inputs (checked worker-side), a\ncandidate for `@pytest.fixture(scope=\"session\")`.",
"type": "boolean"
},
"count": {
"description": "Setups across all workers.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"name": {
"description": "Fixture name.",
"type": "string"
},
"projected_saving_seconds": {
"description": "Projected wall-time saved by promoting this candidate to session scope:\nthe largest per-worker-session `(calls - 1) * mean_setup`, i.e. the\nredundant re-setups removed on the worker that benefits most.\n0 unless `constant`.",
"type": "number",
"format": "double"
},
"scope": {
"description": "pytest scope: `function`, `class`, `module`, `package` or `session`.",
"type": "string"
},
"total_seconds": {
"description": "Setup time summed across all workers, in seconds.",
"type": "number",
"format": "double"
}
},
"required": [
"name",
"scope",
"count",
"total_seconds"
]
},
"FixtureGrouping": {
"description": "What fixture-cost-aware dispatch saved: each module or class it kept on\none worker, its setups this run, and how many plain chunked dispatch would\nhave caused (an estimate from the chunk size and worker count).",
"type": "object",
"properties": {
"groups": {
"description": "Every group, most saved first.",
"type": "array",
"items": {
"$ref": "#/definitions/GroupEntry"
}
},
"saved_seconds": {
"description": "Setup seconds saved over every group, against plain chunked dispatch.",
"type": "number",
"format": "double"
}
},
"required": [
"saved_seconds",
"groups"
]
},
"GateTest": {
"type": "object",
"properties": {
"duration": {
"description": "Its whole-protocol time (setup + call + teardown), in seconds.",
"type": "number",
"format": "double"
},
"nodeid": {
"description": "The test that gates the wall time.",
"type": "string"
}
},
"required": [
"nodeid",
"duration"
]
},
"GroupEntry": {
"type": "object",
"properties": {
"chunked_setups": {
"description": "About how many times plain chunked dispatch would have set them up.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"saved_seconds": {
"description": "`(chunked_setups - setups) * setup_seconds`, never negative.",
"type": "number",
"format": "double"
},
"scope": {
"description": "The module's or class's nodeid.",
"type": "string"
},
"setup_seconds": {
"description": "One setup's recorded seconds.",
"type": "number",
"format": "double"
},
"setups": {
"description": "Times its module/class fixtures were set up this run.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"tests": {
"description": "Tests in it this run dispatched.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"scope",
"tests",
"setups",
"chunked_setups",
"setup_seconds",
"saved_seconds"
]
},
"Leak": {
"description": "A test that ended with more threads / open fds than it started: a resource\nit opened and never released (its own teardown included). Or a class,\nmodule or package fixture whose resources outlived its scope end in at\nleast two of its setups (`scope` set).",
"type": "object",
"properties": {
"fds": {
"description": "Fds the test opened that are still open after its teardown (0 if only\nthreads leaked).",
"type": "integer",
"format": "int64"
},
"nodeid": {
"description": "The test that leaked, or the fixture (`baseid::name`) when `scope` is\nset.",
"type": "string"
},
"scope": {
"description": "The fixture's scope (`class`, `module`, `package`); absent for a test.",
"type": [
"string",
"null"
]
},
"threads": {
"description": "Threads the test created that outlived its teardown (0 if only fds\nleaked).",
"type": "integer",
"format": "int64"
}
},
"required": [
"nodeid",
"threads",
"fds"
]
},
"NetworkAccess": {
"description": "Tests that reached the network, from the worker's network guard.",
"type": "object",
"properties": {
"tests": {
"description": "Those tests, most destinations first (top 20).",
"type": "array",
"items": {
"$ref": "#/definitions/NetworkTest"
}
},
"tests_with_network": {
"description": "Tests that connected outside loopback and the allowlist.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"tests_with_network",
"tests"
]
},
"NetworkTest": {
"type": "object",
"properties": {
"destinations": {
"description": "Destinations it connected to, as `host:port` (with the IP when it was\nresolved from a name).",
"type": "array",
"items": {
"type": "string"
}
},
"nodeid": {
"description": "The test.",
"type": "string"
}
},
"required": [
"nodeid",
"destinations"
]
},
"ParallelEfficiency": {
"description": "Realized parallel speedup measured from an actual run. Unlike\n`ParallelFloor` (a static pre-run estimate), this is the after-the-fact\n\"why isn't `-n auto` faster?\". Only for multi-worker pool runs.",
"type": "object",
"properties": {
"efficiency_pct": {
"description": "100 * realized / ideal: how busy the workers were, up to 100%.",
"type": "number",
"format": "double"
},
"ideal_speedup": {
"description": "Worker count (`-n`) - the ceiling for a purely CPU-bound suite.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"imbalance_pct": {
"description": "100 * (busiest - idlest) / busiest. High = uneven distribution.",
"type": "number",
"format": "double"
},
"long_pole_seconds": {
"description": "Slowest single test (setup + call + teardown): the hard floor no\nworker count beats.",
"type": "number",
"format": "double"
},
"realized_speedup": {
"description": "test_time / wall. At most `ideal_speedup`, since each worker runs one\ntest at a time; a wait-bound suite run with `-n` above the core count\ncan realize more than the core count.",
"type": "number",
"format": "double"
},
"workers_busy": {
"description": "Busy time summed per worker, descending - the load-balance picture.",
"type": "array",
"items": {
"$ref": "#/definitions/WorkerLoad"
}
}
},
"required": [
"realized_speedup",
"ideal_speedup",
"efficiency_pct",
"workers_busy",
"imbalance_pct",
"long_pole_seconds"
]
},
"ParallelFloor": {
"type": "object",
"properties": {
"gate_tests": {
"description": "The tests that exceed the floor, longest first (at most 10).",
"type": "array",
"items": {
"$ref": "#/definitions/GateTest"
}
},
"ideal_share_seconds": {
"description": "A worker's even share of the test time (`test_time_seconds /\nworkers`), in seconds.",
"type": "number",
"format": "double"
},
"longest_seconds": {
"description": "The longest single test (setup + call + teardown), in seconds.",
"type": "number",
"format": "double"
}
},
"required": [
"longest_seconds",
"ideal_share_seconds",
"gate_tests"
]
},
"TimeoutAdvice": {
"description": "Timeouts that catch a hang without killing a slow-but-healthy test. Each\ntest's own limit is the larger of 3x its slowest recorded passing run and\nthat run plus 1s, rounded up to whole seconds.",
"type": "object",
"properties": {
"marker_covered": {
"description": "Tests that would need one but already carry a `@pytest.mark.timeout`\nat least as high; not in `override_count`.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"override_count": {
"description": "Judged tests whose own limit is above `suite_timeout`: they need a\nper-test `@pytest.mark.timeout`.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"overrides": {
"description": "The highest of those, worst first (top 20).",
"type": "array",
"items": {
"$ref": "#/definitions/TimeoutOverride"
}
},
"suite_timeout": {
"description": "Suggested suite-wide `--timeout`, in seconds: the limit that covers 95%\nof the judged tests.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"tests_judged": {
"description": "Tests in this run with at least 5 passing runs in the history.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"suite_timeout",
"tests_judged",
"override_count",
"marker_covered",
"overrides"
]
},
"TimeoutOverride": {
"type": "object",
"properties": {
"current": {
"description": "Its current `@pytest.mark.timeout`, below the suggestion; absent when\nit has none.",
"type": [
"number",
"null"
],
"format": "double"
},
"nodeid": {
"description": "The test.",
"type": "string"
},
"runs": {
"description": "Passing runs that slowest time comes from.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"slowest_seconds": {
"description": "Its slowest recorded passing call-phase time, in seconds (the phase\n`--timeout` limits; fixture setup/teardown not included).",
"type": "number",
"format": "double"
},
"timeout": {
"description": "Its suggested `@pytest.mark.timeout`, in seconds.",
"type": "integer",
"format": "uint64",
"minimum": 0
}
},
"required": [
"nodeid",
"slowest_seconds",
"runs",
"timeout"
]
},
"WaitBound": {
"type": "object",
"properties": {
"tests": {
"description": "The biggest waiters, most waiting first (top 50): tests of at least\n0.2s that spent 60% or more of their time waiting.",
"type": "array",
"items": {
"$ref": "#/definitions/WaitTest"
}
},
"wait_pct": {
"description": "`wait_seconds` as a percentage of `test_time_seconds`.",
"type": "number",
"format": "double"
},
"wait_seconds": {
"description": "Test time spent waiting rather than on CPU (`test_time_seconds -\ncpu_time_seconds`).",
"type": "number",
"format": "double"
}
},
"required": [
"wait_seconds",
"wait_pct",
"tests"
]
},
"WaitTest": {
"type": "object",
"properties": {
"duration": {
"description": "Its whole-protocol time (setup + call + teardown), in seconds.",
"type": "number",
"format": "double"
},
"nodeid": {
"description": "The waiting test.",
"type": "string"
},
"wait": {
"description": "The part of `duration` not spent on CPU, in seconds.",
"type": "number",
"format": "double"
}
},
"required": [
"nodeid",
"duration",
"wait"
]
},
"WasteTest": {
"type": "object",
"properties": {
"also_covered_by": {
"description": "Distinct OTHER tests that between them also cover those lines.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"covered_lines": {
"description": "Lines this test covered, all shared with at least one other test.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"duration": {
"description": "Its whole-protocol time (setup + call + teardown), in seconds.",
"type": "number",
"format": "double"
},
"nodeid": {
"description": "The redundant test.",
"type": "string"
}
},
"required": [
"nodeid",
"duration",
"covered_lines",
"also_covered_by"
]
},
"WorkerLoad": {
"type": "object",
"properties": {
"busy_seconds": {
"description": "Test time this worker spent running tests, in seconds.",
"type": "number",
"format": "double"
},
"tests": {
"description": "Tests this worker ran.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"worker": {
"description": "Worker id (`gw0`, `gw1`, ...), or `serial` for tests with no\nrecorded worker.",
"type": "string"
}
},
"required": [
"worker",
"busy_seconds",
"tests"
]
}
}
}
Discovery¶
Source: --collect-only --report-json
The --collect-only --report-json discovery document (schema 1). Field order is alphabetical to match the historical serde_json::Map output (serde_json has no preserve_order here), so the emitted bytes are unchanged by the move to a typed struct.
| Field | Type | Required | Description |
|---|---|---|---|
collect_errors |
array of CollectError | yes | Per-collector import/collection errors (empty on a clean collection). |
meta |
DiscoveryMeta | yes | Envelope: producer, document kind, schema version, rootdir and test count. |
tests |
array of DiscoveredTest | yes | One entry per collected test item, in collection order. |
CollectError¶
A collection-time error (one collector that failed to import/collect).
| Field | Type | Required | Description |
|---|---|---|---|
longrepr |
string | yes | The failure text (traceback / repr). |
path |
string | yes | The path pytest was collecting when it failed. |
DiscoveredTest¶
One discovered test item.
| Field | Type | Required | Description |
|---|---|---|---|
file |
string | yes | Absolute source file, or empty when pytest reported no location. |
lineno |
integer or null | yes | 0-based definition line, or null when pytest reported none. |
markers |
array of string | yes | All pytest marker names on the item (own + inherited). |
nodeid |
string | yes | The pytest node id. |
DiscoveryMeta¶
Envelope metadata for the discovery document.
| Field | Type | Required | Description |
|---|---|---|---|
count |
integer | yes | Number of collected test items (tests.len()). |
kind |
string | yes | Constant discriminator: always "discovery". |
rootdir |
string | yes | Absolute project root; file paths are resolved against it. |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
Discovery: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DiscoveryDoc",
"description": "The `--collect-only --report-json` discovery document (schema 1). Field\norder is alphabetical to match the historical `serde_json::Map` output\n(serde_json has no `preserve_order` here), so the emitted bytes are\nunchanged by the move to a typed struct.",
"type": "object",
"properties": {
"collect_errors": {
"description": "Per-collector import/collection errors (empty on a clean collection).",
"type": "array",
"items": {
"$ref": "#/definitions/CollectError"
}
},
"meta": {
"description": "Envelope: producer, document kind, schema version, rootdir and test\ncount.",
"allOf": [
{
"$ref": "#/definitions/DiscoveryMeta"
}
]
},
"tests": {
"description": "One entry per collected test item, in collection order.",
"type": "array",
"items": {
"$ref": "#/definitions/DiscoveredTest"
}
}
},
"required": [
"collect_errors",
"meta",
"tests"
],
"definitions": {
"CollectError": {
"description": "A collection-time error (one collector that failed to import/collect).",
"type": "object",
"properties": {
"longrepr": {
"description": "The failure text (traceback / repr).",
"type": "string"
},
"path": {
"description": "The path pytest was collecting when it failed.",
"type": "string"
}
},
"required": [
"longrepr",
"path"
]
},
"DiscoveredTest": {
"description": "One discovered test item.",
"type": "object",
"properties": {
"file": {
"description": "Absolute source file, or empty when pytest reported no location.",
"type": "string"
},
"lineno": {
"description": "0-based definition line, or null when pytest reported none.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0
},
"markers": {
"description": "All pytest marker names on the item (own + inherited).",
"type": "array",
"items": {
"type": "string"
}
},
"nodeid": {
"description": "The pytest node id.",
"type": "string"
}
},
"required": [
"file",
"lineno",
"markers",
"nodeid"
]
},
"DiscoveryMeta": {
"description": "Envelope metadata for the discovery document.",
"type": "object",
"properties": {
"count": {
"description": "Number of collected test items (`tests.len()`).",
"type": "integer",
"format": "uint",
"minimum": 0
},
"kind": {
"description": "Constant discriminator: always `\"discovery\"`.",
"type": "string"
},
"rootdir": {
"description": "Absolute project root; `file` paths are resolved against it.",
"type": "string"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"count",
"kind",
"rootdir",
"runner",
"schema"
]
}
}
}
Migrate-check¶
Source: migrate-check --migrate-check-json
The --migrate-check-json document (schema 1). Field order is alphabetical to match the historical serde_json map output (no preserve_order), so the emitted bytes are unchanged by the move to typed structs.
| Field | Type | Required | Description |
|---|---|---|---|
meta |
MigrateMeta | yes | Envelope: kind is "migrate-check". |
parallel |
ParallelReport or null | yes | Parallel-phase result: null when the phase was skipped (WILL-bail ids force -n 0); {"ran": false} when it started but captured no outcomes. |
ready |
boolean | yes | Whether the suite is parallel-ready (no blocking findings). |
tests_collected |
integer | yes | Tests collected (union across the two collection runs). |
unstable_ids |
array of UnstableSite | yes | Unstable-nodeid findings, grouped by test site. |
will_bail_count |
integer | yes | Count of ids that force -n 0: per-process-unstable ids plus ids at order-unstable sites (order kind). |
Finding¶
One parallel-only failure finding.
| Field | Type | Required | Description |
|---|---|---|---|
allowed |
boolean | yes | Whether this nodeid is on the allow list. |
fix |
string | yes | The suggested fix. |
nodeid |
string | yes | The failing test's node id. |
polluter |
PolluterJson or null | yes | The bisected polluter, or null when none was found. |
verdict |
string | yes | The classification verdict title. |
why |
string | yes | Why it fails only under parallelism. |
MigrateMeta (Migrate-check)¶
Envelope metadata shared by the migrate documents.
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string | yes | Constant discriminator: the producing subcommand ("migrate-check", "xdist-removal-check"). |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
ParallelReport¶
Result of the parallel phase. Fields other than ran are absent when the phase did not actually run to completion.
| Field | Type | Required | Description |
|---|---|---|---|
findings |
array of Finding | no | Per-test parallel-only findings (empty when ready). |
preexisting |
integer | no | Tests that already fail at -n 0 (pre-existing, not a parallelism bug). |
ran |
boolean | yes | Whether the parallel phase actually ran. |
ready |
boolean | no | Whether it passed (present only once the phase ran). |
PolluterJson¶
A finding's polluter: the file that, run first, reproduces the failure.
| Field | Type | Required | Description |
|---|---|---|---|
file |
string | no | The polluting file (absent for not_reproducible). |
kind |
string | yes | Polluter kind: other_file, same_file, or not_reproducible. |
UnstableSite¶
One unstable-nodeid finding, grouped by test site (file::test).
| Field | Type | Required | Description |
|---|---|---|---|
allowed |
boolean | yes | Whether this site matches a --migrate-allow entry. |
fix |
string | yes | The upstream fix for the worst instability kind here. |
kinds |
object of integer | yes | Count of unstable ids at this site, keyed by instability kind. |
sample |
string | yes | A sample parametrize id from this site. |
site |
string | yes | The test site (file::test). |
will_bail |
boolean | yes | Whether the site WILL bail at -n auto (per-process-unstable id). |
Migrate-check: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MigrateCheckDoc",
"description": "The `--migrate-check-json` document (schema 1). Field order is alphabetical\nto match the historical `serde_json` map output (no `preserve_order`), so\nthe emitted bytes are unchanged by the move to typed structs.",
"type": "object",
"properties": {
"meta": {
"description": "Envelope: `kind` is `\"migrate-check\"`.",
"allOf": [
{
"$ref": "#/definitions/MigrateMeta"
}
]
},
"parallel": {
"description": "Parallel-phase result: `null` when the phase was skipped (WILL-bail ids\nforce `-n 0`); `{\"ran\": false}` when it started but captured no outcomes.",
"anyOf": [
{
"$ref": "#/definitions/ParallelReport"
},
{
"type": "null"
}
]
},
"ready": {
"description": "Whether the suite is parallel-ready (no blocking findings).",
"type": "boolean"
},
"tests_collected": {
"description": "Tests collected (union across the two collection runs).",
"type": "integer",
"format": "uint",
"minimum": 0
},
"unstable_ids": {
"description": "Unstable-nodeid findings, grouped by test site.",
"type": "array",
"items": {
"$ref": "#/definitions/UnstableSite"
}
},
"will_bail_count": {
"description": "Count of ids that force `-n 0`: per-process-unstable ids plus ids at\norder-unstable sites (`order` kind).",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"meta",
"parallel",
"ready",
"tests_collected",
"unstable_ids",
"will_bail_count"
],
"definitions": {
"Finding": {
"description": "One parallel-only failure finding.",
"type": "object",
"properties": {
"allowed": {
"description": "Whether this nodeid is on the allow list.",
"type": "boolean"
},
"fix": {
"description": "The suggested fix.",
"type": "string"
},
"nodeid": {
"description": "The failing test's node id.",
"type": "string"
},
"polluter": {
"description": "The bisected polluter, or `null` when none was found.",
"anyOf": [
{
"$ref": "#/definitions/PolluterJson"
},
{
"type": "null"
}
]
},
"verdict": {
"description": "The classification verdict title.",
"type": "string"
},
"why": {
"description": "Why it fails only under parallelism.",
"type": "string"
}
},
"required": [
"allowed",
"fix",
"nodeid",
"polluter",
"verdict",
"why"
]
},
"MigrateMeta": {
"description": "Envelope metadata shared by the migrate documents.",
"type": "object",
"properties": {
"kind": {
"description": "Constant discriminator: the producing subcommand (`\"migrate-check\"`,\n`\"xdist-removal-check\"`).",
"type": "string"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"kind",
"runner",
"schema"
]
},
"ParallelReport": {
"description": "Result of the parallel phase. Fields other than `ran` are absent\nwhen the phase did not actually run to completion.",
"type": "object",
"properties": {
"findings": {
"description": "Per-test parallel-only findings (empty when ready).",
"type": "array",
"items": {
"$ref": "#/definitions/Finding"
}
},
"preexisting": {
"description": "Tests that already fail at `-n 0` (pre-existing, not a parallelism bug).",
"type": "integer",
"format": "uint",
"minimum": 0
},
"ran": {
"description": "Whether the parallel phase actually ran.",
"type": "boolean"
},
"ready": {
"description": "Whether it passed (present only once the phase ran).",
"type": "boolean"
}
},
"required": [
"ran"
]
},
"PolluterJson": {
"description": "A finding's polluter: the file that, run first, reproduces the failure.",
"type": "object",
"properties": {
"file": {
"description": "The polluting file (absent for `not_reproducible`).",
"type": "string"
},
"kind": {
"description": "Polluter kind: `other_file`, `same_file`, or `not_reproducible`.",
"type": "string"
}
},
"required": [
"kind"
]
},
"UnstableSite": {
"description": "One unstable-nodeid finding, grouped by test site (`file::test`).",
"type": "object",
"properties": {
"allowed": {
"description": "Whether this site matches a `--migrate-allow` entry.",
"type": "boolean"
},
"fix": {
"description": "The upstream fix for the worst instability kind here.",
"type": "string"
},
"kinds": {
"description": "Count of unstable ids at this site, keyed by instability kind.",
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"sample": {
"description": "A sample parametrize id from this site.",
"type": "string"
},
"site": {
"description": "The test site (`file::test`).",
"type": "string"
},
"will_bail": {
"description": "Whether the site WILL bail at `-n auto` (per-process-unstable id).",
"type": "boolean"
}
},
"required": [
"allowed",
"fix",
"kinds",
"sample",
"site",
"will_bail"
]
}
}
}
Xdist-removal-check¶
Source: xdist-removal-check --xdist-removal-json
The --xdist-removal-json document (schema 1). Fields are alphabetical, as in the other migrate documents.
| Field | Type | Required | Description |
|---|---|---|---|
findings |
array of RemovalFinding | yes | Every finding, blocking ones first. |
meta |
MigrateMeta | yes | Envelope: kind is "xdist-removal-check". |
ready |
boolean | yes | Whether pytest-xdist can be uninstalled now (no non-allowed blocking finding, and the trial passed when it ran). |
trial |
TrialReport or null | yes | The --xdist-trial result: null when the trial was not requested. |
xdist_version |
string or null | yes | The installed pytest-xdist version: null when it is not installed or the interpreter could not be probed. |
MigrateMeta (Xdist-removal-check)¶
Envelope metadata shared by the migrate documents.
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string | yes | Constant discriminator: the producing subcommand ("migrate-check", "xdist-removal-check"). |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
RemovalFinding¶
One thing that breaks or changes when pytest-xdist is removed.
| Field | Type | Required | Description |
|---|---|---|---|
allowed |
boolean | yes | Whether this location is on the --migrate-allow list. |
blocking |
boolean | yes | Whether it breaks the run once xdist is gone (false: a behavior change or a warning). |
fix |
string | yes | The suggested fix. |
kind |
string | yes | Finding kind: addopts_flag, addopts_ignored, required_plugin, ini_key, import, hook, hasplugin_gate, importorskip (also a skip under a guarded import xdist), plugin_import, or plugin_gate. |
location |
string | yes | Where it is: a config source (pytest.ini addopts, PYTEST_ADDOPTS) or path:line. |
text |
string | yes | The offending flag, key, or source line. |
why |
string | yes | What happens once pytest-xdist is gone. |
TrialReport¶
Result of the --xdist-trial run with -p no:xdist.
| Field | Type | Required | Description |
|---|---|---|---|
baseline_error |
string or null | no | The tail of the child's stderr when pytest-xdist is installed but the run with it loaded never started, so nothing could be compared. |
compared |
boolean | yes | Whether a run with pytest-xdist loaded was compared against (false when it isn't installed, so nothing can be called a regression). |
error |
string or null | no | The tail of the child's stderr when the session never started. |
failed |
integer | yes | Tests that failed with xdist hidden. |
flaky |
array of string | yes | Tests that failed without pytest-xdist in the trial but passed when re-run without it: flaky, not a dependency on it. Not blocking. |
regressions |
array of string | yes | Tests that pass with pytest-xdist loaded but fail, skip, or are no longer collected with it hidden, every time they were re-run. |
started |
boolean | yes | Whether the session with xdist hidden started and reported outcomes. |
tests |
integer | yes | Tests that ran with xdist hidden. |
Xdist-removal-check: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "XdistRemovalDoc",
"description": "The `--xdist-removal-json` document (schema 1). Fields are alphabetical, as\nin the other migrate documents.",
"type": "object",
"properties": {
"findings": {
"description": "Every finding, blocking ones first.",
"type": "array",
"items": {
"$ref": "#/definitions/RemovalFinding"
}
},
"meta": {
"description": "Envelope: `kind` is `\"xdist-removal-check\"`.",
"allOf": [
{
"$ref": "#/definitions/MigrateMeta"
}
]
},
"ready": {
"description": "Whether pytest-xdist can be uninstalled now (no non-allowed blocking\nfinding, and the trial passed when it ran).",
"type": "boolean"
},
"trial": {
"description": "The `--xdist-trial` result: `null` when the trial was not requested.",
"anyOf": [
{
"$ref": "#/definitions/TrialReport"
},
{
"type": "null"
}
]
},
"xdist_version": {
"description": "The installed pytest-xdist version: `null` when it is not installed or\nthe interpreter could not be probed.",
"type": [
"string",
"null"
]
}
},
"required": [
"findings",
"meta",
"ready",
"trial",
"xdist_version"
],
"definitions": {
"MigrateMeta": {
"description": "Envelope metadata shared by the migrate documents.",
"type": "object",
"properties": {
"kind": {
"description": "Constant discriminator: the producing subcommand (`\"migrate-check\"`,\n`\"xdist-removal-check\"`).",
"type": "string"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"kind",
"runner",
"schema"
]
},
"RemovalFinding": {
"description": "One thing that breaks or changes when pytest-xdist is removed.",
"type": "object",
"properties": {
"allowed": {
"description": "Whether this location is on the `--migrate-allow` list.",
"type": "boolean"
},
"blocking": {
"description": "Whether it breaks the run once xdist is gone (`false`: a behavior\nchange or a warning).",
"type": "boolean"
},
"fix": {
"description": "The suggested fix.",
"type": "string"
},
"kind": {
"description": "Finding kind: `addopts_flag`, `addopts_ignored`, `required_plugin`,\n`ini_key`, `import`, `hook`, `hasplugin_gate`, `importorskip` (also a\nskip under a guarded `import xdist`), `plugin_import`, or `plugin_gate`.",
"type": "string"
},
"location": {
"description": "Where it is: a config source (`pytest.ini addopts`, `PYTEST_ADDOPTS`)\nor `path:line`.",
"type": "string"
},
"text": {
"description": "The offending flag, key, or source line.",
"type": "string"
},
"why": {
"description": "What happens once pytest-xdist is gone.",
"type": "string"
}
},
"required": [
"allowed",
"blocking",
"fix",
"kind",
"location",
"text",
"why"
]
},
"TrialReport": {
"description": "Result of the `--xdist-trial` run with `-p no:xdist`.",
"type": "object",
"properties": {
"baseline_error": {
"description": "The tail of the child's stderr when pytest-xdist is installed but the\nrun with it loaded never started, so nothing could be compared.",
"type": [
"string",
"null"
]
},
"compared": {
"description": "Whether a run with pytest-xdist loaded was compared against (`false`\nwhen it isn't installed, so nothing can be called a regression).",
"type": "boolean"
},
"error": {
"description": "The tail of the child's stderr when the session never started.",
"type": [
"string",
"null"
]
},
"failed": {
"description": "Tests that failed with xdist hidden.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"flaky": {
"description": "Tests that failed without pytest-xdist in the trial but passed when\nre-run without it: flaky, not a dependency on it. Not blocking.",
"type": "array",
"items": {
"type": "string"
}
},
"regressions": {
"description": "Tests that pass with pytest-xdist loaded but fail, skip, or are no\nlonger collected with it hidden, every time they were re-run.",
"type": "array",
"items": {
"type": "string"
}
},
"started": {
"description": "Whether the session with xdist hidden started and reported outcomes.",
"type": "boolean"
},
"tests": {
"description": "Tests that ran with xdist hidden.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"compared",
"failed",
"regressions",
"flaky",
"started",
"tests"
]
}
}
}
Audit¶
Source: audit --audit-json
The --audit-json document (schema 1). Every field but meta, ran and parallel_safe is absent when the audit did not run.
| Field | Type | Required | Description |
|---|---|---|---|
inconclusive |
array of string | no | Tests that failed in the parallel pass but did not run in the follow-up runs, so could not be classified. They still fail the gate. |
intrinsic_flakes |
array of string | no | Tests that fail intermittently whatever the scheduling (intrinsic flakes). |
meta |
AuditMeta | yes | Envelope: producer, document kind and schema version. |
order_dependent |
array of string | no | Tests that pass under --dist loadfile: they depend on a sibling in their file running first, so keep the file together rather than serial. |
parallel_safe |
boolean | yes | Whether the suite is parallel-safe (no parallel-only failures). Always false when the audit did not run. |
preexisting_failures |
integer | no | Tests that already fail at -n 0: pre-existing, not a parallelism issue, and not counted against the gate. |
ran |
boolean | yes | Whether the parallel pass produced a run to audit. |
serial_candidates |
array of SerialCandidate | no | Tests fixable by pinning them to @pytest.mark.serial. |
serial_conftest |
string | no | A paste-able conftest.py block that marks every serial candidate. |
tests |
integer | no | Tests audited (0 when the selection matched nothing). |
AuditMeta¶
Envelope metadata for the audit document.
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string | yes | Constant discriminator: always "audit". |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
SerialCandidate¶
One test fixable by @pytest.mark.serial.
| Field | Type | Required | Description |
|---|---|---|---|
fix |
string | yes | The underlying (non-stopgap) fix for this verdict. |
nodeid |
string | yes | The failing test's node id. |
verdict |
string | yes | The classification verdict title. |
Audit: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "AuditDoc",
"description": "The `--audit-json` document (schema 1). Every field but `meta`, `ran` and\n`parallel_safe` is absent when the audit did not run.",
"type": "object",
"properties": {
"inconclusive": {
"description": "Tests that failed in the parallel pass but did not run in the follow-up\nruns, so could not be classified. They still fail the gate.",
"type": "array",
"items": {
"type": "string"
}
},
"intrinsic_flakes": {
"description": "Tests that fail intermittently whatever the scheduling (intrinsic flakes).",
"type": "array",
"items": {
"type": "string"
}
},
"meta": {
"description": "Envelope: producer, document kind and schema version.",
"allOf": [
{
"$ref": "#/definitions/AuditMeta"
}
]
},
"order_dependent": {
"description": "Tests that pass under `--dist loadfile`: they depend on a sibling in\ntheir file running first, so keep the file together rather than serial.",
"type": "array",
"items": {
"type": "string"
}
},
"parallel_safe": {
"description": "Whether the suite is parallel-safe (no parallel-only failures). Always\n`false` when the audit did not run.",
"type": "boolean"
},
"preexisting_failures": {
"description": "Tests that already fail at `-n 0`: pre-existing, not a parallelism\nissue, and not counted against the gate.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"ran": {
"description": "Whether the parallel pass produced a run to audit.",
"type": "boolean"
},
"serial_candidates": {
"description": "Tests fixable by pinning them to `@pytest.mark.serial`.",
"type": "array",
"items": {
"$ref": "#/definitions/SerialCandidate"
}
},
"serial_conftest": {
"description": "A paste-able `conftest.py` block that marks every serial candidate.",
"type": "string"
},
"tests": {
"description": "Tests audited (0 when the selection matched nothing).",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"meta",
"parallel_safe",
"ran"
],
"definitions": {
"AuditMeta": {
"description": "Envelope metadata for the audit document.",
"type": "object",
"properties": {
"kind": {
"description": "Constant discriminator: always `\"audit\"`.",
"type": "string"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"kind",
"runner",
"schema"
]
},
"SerialCandidate": {
"description": "One test fixable by `@pytest.mark.serial`.",
"type": "object",
"properties": {
"fix": {
"description": "The underlying (non-stopgap) fix for this verdict.",
"type": "string"
},
"nodeid": {
"description": "The failing test's node id.",
"type": "string"
},
"verdict": {
"description": "The classification verdict title.",
"type": "string"
}
},
"required": [
"fix",
"nodeid",
"verdict"
]
}
}
}
Bisect¶
Source: bisect --bisect-json
The --bisect-json document (schema 1). A run that ended without a verdict (refused, or an error) carries error and no rootdir/cwd.
| Field | Type | Required | Description |
|---|---|---|---|
culprits |
array of string | yes | The culprit test ids, in the order they run before the victim. Empty when the victim is not order-dependent or the run ended without a verdict. |
cwd |
string | no | Directory reproduce_command runs from. |
error |
string | no | Why the run ended without a verdict (absent on a completed bisect). |
meta |
BisectMeta | yes | Envelope: producer, document kind and schema version. |
nodeid |
string | yes | The victim test's node id, relative to rootdir. |
order_dependent |
boolean | yes | Whether the victim fails only after the culprits run first. |
reproduce_command |
string or null | yes | A command that reproduces the failure, or null when the victim is not order-dependent. |
rootdir |
string | no | The pytest rootdir the node ids are relative to. |
BisectMeta¶
Envelope metadata for the bisect document.
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string | yes | Constant discriminator: always "bisect". |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
Bisect: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "BisectDoc",
"description": "The `--bisect-json` document (schema 1). A run that ended without a verdict\n(refused, or an error) carries `error` and no `rootdir`/`cwd`.",
"type": "object",
"properties": {
"culprits": {
"description": "The culprit test ids, in the order they run before the victim. Empty\nwhen the victim is not order-dependent or the run ended without a verdict.",
"type": "array",
"items": {
"type": "string"
}
},
"cwd": {
"description": "Directory `reproduce_command` runs from.",
"type": "string"
},
"error": {
"description": "Why the run ended without a verdict (absent on a completed bisect).",
"type": "string"
},
"meta": {
"description": "Envelope: producer, document kind and schema version.",
"allOf": [
{
"$ref": "#/definitions/BisectMeta"
}
]
},
"nodeid": {
"description": "The victim test's node id, relative to `rootdir`.",
"type": "string"
},
"order_dependent": {
"description": "Whether the victim fails only after the culprits run first.",
"type": "boolean"
},
"reproduce_command": {
"description": "A command that reproduces the failure, or `null` when the victim is\nnot order-dependent.",
"type": [
"string",
"null"
]
},
"rootdir": {
"description": "The pytest rootdir the node ids are relative to.",
"type": "string"
}
},
"required": [
"culprits",
"meta",
"nodeid",
"order_dependent",
"reproduce_command"
],
"definitions": {
"BisectMeta": {
"description": "Envelope metadata for the bisect document.",
"type": "object",
"properties": {
"kind": {
"description": "Constant discriminator: always `\"bisect\"`.",
"type": "string"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"kind",
"runner",
"schema"
]
}
}
}
Explain¶
Source: explain --json
The merged per-nodeid dossier. null fields are simply absent from every cache (e.g. a never-flaked test has no flakes entry). found is false when the nodeid appears in no cache at all.
| Field | Type | Required | Description |
|---|---|---|---|
coverage |
Coverage or null | yes | Files this test covered, if a warm coverage index has it. |
duration_seconds |
number or null | yes | Last recorded call-phase duration in seconds (see history for the spread). |
flakes |
FlakeStats or null | yes | Cross-run flake/fail counts + last-event epoch, if the test has any. |
found |
boolean | yes | Whether the node id appears in any cache. |
history |
HistorySummary or null | yes | Recent runs, if the per-test history has any. |
last_outcome |
string or null | yes | "passed" if the test was green on the last incremental run; null otherwise (absence is not proof of failure; see flakes for fail history). |
meta |
Meta | yes | Envelope: producer, document kind, schema version and rstest version. |
nodeid |
string | yes | The node id that was explained, as given. |
source_line |
integer or null | yes | Source def line (1-based) recorded on the last incremental run, if known. |
Coverage¶
The coverage footprint of one test: the source files it covered and the total number of covered lines across them.
| Field | Type | Required | Description |
|---|---|---|---|
file_count |
integer | yes | Number of source files the test covered. |
files |
array of string | yes | Covered source files, sorted, rootdir-relative (the coverage-index keys). |
line_count |
integer | yes | Covered lines, summed across those files. |
FlakeStats (Explain)¶
| Field | Type | Required | Description |
|---|---|---|---|
failed |
integer | yes | Runs where the test hard-failed (quarantined failures included). |
flaky |
integer | yes | Runs where the test passed only after rerun(s). |
last_epoch |
integer | yes | Unix epoch of the last recorded event (flake or failure). |
last_failed_epoch |
integer | yes | Unix epoch of the last hard failure. 0 = none, or a cache written before this field existed (readers then fall back to last_epoch when failed is non-zero). |
HistorySummary¶
The test's recent runs from the per-test history (oldest first).
| Field | Type | Required | Description |
|---|---|---|---|
auto_quarantine_at |
integer | yes | Flips at which --auto-quarantine catches a test ([tool.rstest] auto-quarantine or the default; 0 = off). |
auto_quarantined_next_run |
boolean | yes | Whether the next run auto-quarantines this test (flips reached auto_quarantine_at and its last 3 pass/fail runs did not all fail), unless the --auto-quarantine-max cap trips. |
call_median |
number or null | yes | Median call-phase seconds over passing runs. |
call_p95 |
number or null | yes | 95th percentile (nearest rank) call-phase seconds over passing runs. |
env_changed |
boolean or null | yes | When the latest run failed: whether the environment fingerprint (interpreter, lockfiles, installed packages) differs between the last passing run and the first failing one. |
first_fail_commit |
string or null | yes | When the latest non-skipped run failed: commit of the first run in that failing streak (skips inside the streak are ignored). Suffixed -dirty like last_pass_commit. |
flips |
integer | yes | Flips in the recorded runs: a pass only on rerun, or a failure right after a pass (the --auto-quarantine rule). |
last_pass_commit |
string or null | yes | Commit of the most recent passing run; suffixed -dirty when that run had uncommitted changes. |
outcomes |
array of string | yes | Outcome per run, oldest first: passed, failed, errors, skipped, xfailed, xpassed, quarantined, flaky or crashed. |
runs |
integer | yes | Number of recorded runs. |
setup_median |
number or null | yes | Median setup-phase seconds over passing runs. |
suspect_commits |
array of SuspectCommit or null | yes | When the latest run failed: the commits after last_pass_commit up to first_fail_commit (git log last..first), newest first. Empty when both are the same commit, or the failing one is an ancestor of the passing one; null when git can't resolve them here. |
Meta (Explain)¶
Envelope metadata for the explain document.
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string | yes | Constant discriminator: always "explain". |
rstest_version |
string | yes | The rstest version that wrote the document. |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
SuspectCommit (Explain)¶
A commit in a suspect range (git log <good>..<bad>).
| Field | Type | Required | Description |
|---|---|---|---|
author |
string | yes | Author name. |
sha |
string | yes | Abbreviated commit hash. |
subject |
string | yes | First line of the commit message. |
Explain: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExplainReport",
"description": "The merged per-nodeid dossier. `null` fields are simply absent from every\ncache (e.g. a never-flaked test has no `flakes` entry). `found` is false when\nthe nodeid appears in no cache at all.",
"type": "object",
"properties": {
"coverage": {
"description": "Files this test covered, if a warm coverage index has it.",
"anyOf": [
{
"$ref": "#/definitions/Coverage"
},
{
"type": "null"
}
]
},
"duration_seconds": {
"description": "Last recorded call-phase duration in seconds (see `history` for the\nspread).",
"type": [
"number",
"null"
],
"format": "double"
},
"flakes": {
"description": "Cross-run flake/fail counts + last-event epoch, if the test has any.",
"anyOf": [
{
"$ref": "#/definitions/FlakeStats"
},
{
"type": "null"
}
]
},
"found": {
"description": "Whether the node id appears in any cache.",
"type": "boolean"
},
"history": {
"description": "Recent runs, if the per-test history has any.",
"anyOf": [
{
"$ref": "#/definitions/HistorySummary"
},
{
"type": "null"
}
]
},
"last_outcome": {
"description": "`\"passed\"` if the test was green on the last incremental run; `null`\notherwise (absence is not proof of failure; see `flakes` for fail\nhistory).",
"type": [
"string",
"null"
]
},
"meta": {
"description": "Envelope: producer, document kind, schema version and rstest version.",
"allOf": [
{
"$ref": "#/definitions/Meta"
}
]
},
"nodeid": {
"description": "The node id that was explained, as given.",
"type": "string"
},
"source_line": {
"description": "Source def line (1-based) recorded on the last incremental run, if known.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0
}
},
"required": [
"meta",
"nodeid",
"found",
"duration_seconds",
"last_outcome",
"source_line",
"flakes",
"coverage",
"history"
],
"definitions": {
"Coverage": {
"description": "The coverage footprint of one test: the source files it covered and the\ntotal number of covered lines across them.",
"type": "object",
"properties": {
"file_count": {
"description": "Number of source files the test covered.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"files": {
"description": "Covered source files, sorted, rootdir-relative (the coverage-index keys).",
"type": "array",
"items": {
"type": "string"
}
},
"line_count": {
"description": "Covered lines, summed across those files.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"file_count",
"line_count",
"files"
]
},
"FlakeStats": {
"type": "object",
"properties": {
"failed": {
"description": "Runs where the test hard-failed (quarantined failures included).",
"type": "integer",
"format": "uint32",
"default": 0,
"minimum": 0
},
"flaky": {
"description": "Runs where the test passed only after rerun(s).",
"type": "integer",
"format": "uint32",
"default": 0,
"minimum": 0
},
"last_epoch": {
"description": "Unix epoch of the last recorded event (flake or failure).",
"type": "integer",
"format": "uint64",
"default": 0,
"minimum": 0
},
"last_failed_epoch": {
"description": "Unix epoch of the last hard failure. 0 = none, or a cache written\nbefore this field existed (readers then fall back to\n`last_epoch` when `failed` is non-zero).",
"type": "integer",
"format": "uint64",
"default": 0,
"minimum": 0
}
},
"required": [
"flaky",
"failed",
"last_epoch",
"last_failed_epoch"
]
},
"HistorySummary": {
"description": "The test's recent runs from the per-test history (oldest first).",
"type": "object",
"properties": {
"auto_quarantine_at": {
"description": "Flips at which `--auto-quarantine` catches a test (`[tool.rstest]\nauto-quarantine` or the default; `0` = off).",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"auto_quarantined_next_run": {
"description": "Whether the next run auto-quarantines this test (`flips` reached\n`auto_quarantine_at` and its last 3 pass/fail runs did not all fail),\nunless the `--auto-quarantine-max` cap trips.",
"type": "boolean"
},
"call_median": {
"description": "Median call-phase seconds over passing runs.",
"type": [
"number",
"null"
],
"format": "double"
},
"call_p95": {
"description": "95th percentile (nearest rank) call-phase seconds over passing runs.",
"type": [
"number",
"null"
],
"format": "double"
},
"env_changed": {
"description": "When the latest run failed: whether the environment fingerprint\n(interpreter, lockfiles, installed packages) differs between the last\npassing run and the first failing one.",
"type": [
"boolean",
"null"
]
},
"first_fail_commit": {
"description": "When the latest non-skipped run failed: commit of the first run in that\nfailing streak (skips inside the streak are ignored). Suffixed `-dirty`\nlike `last_pass_commit`.",
"type": [
"string",
"null"
]
},
"flips": {
"description": "Flips in the recorded runs: a pass only on rerun, or a failure right\nafter a pass (the `--auto-quarantine` rule).",
"type": "integer",
"format": "uint",
"minimum": 0
},
"last_pass_commit": {
"description": "Commit of the most recent passing run; suffixed `-dirty` when that run\nhad uncommitted changes.",
"type": [
"string",
"null"
]
},
"outcomes": {
"description": "Outcome per run, oldest first: `passed`, `failed`, `errors`, `skipped`,\n`xfailed`, `xpassed`, `quarantined`, `flaky` or `crashed`.",
"type": "array",
"items": {
"type": "string"
}
},
"runs": {
"description": "Number of recorded runs.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"setup_median": {
"description": "Median setup-phase seconds over passing runs.",
"type": [
"number",
"null"
],
"format": "double"
},
"suspect_commits": {
"description": "When the latest run failed: the commits after `last_pass_commit` up to\n`first_fail_commit` (`git log last..first`), newest first. Empty when\nboth are the same commit, or the failing one is an ancestor of the\npassing one; null when git can't resolve them here.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/SuspectCommit"
}
}
},
"required": [
"runs",
"outcomes",
"call_median",
"call_p95",
"setup_median",
"last_pass_commit",
"first_fail_commit",
"env_changed",
"suspect_commits",
"flips",
"auto_quarantine_at",
"auto_quarantined_next_run"
]
},
"Meta": {
"description": "Envelope metadata for the explain document.",
"type": "object",
"properties": {
"kind": {
"description": "Constant discriminator: always `\"explain\"`.",
"type": "string"
},
"rstest_version": {
"description": "The rstest version that wrote the document.",
"type": "string"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"runner",
"kind",
"schema",
"rstest_version"
]
},
"SuspectCommit": {
"description": "A commit in a suspect range (`git log <good>..<bad>`).",
"type": "object",
"properties": {
"author": {
"description": "Author name.",
"type": "string"
},
"sha": {
"description": "Abbreviated commit hash.",
"type": "string"
},
"subject": {
"description": "First line of the commit message.",
"type": "string"
}
},
"required": [
"sha",
"author",
"subject"
]
}
}
}
Flaky¶
Source: flaky --json
The ranked flake view. Tests are sorted by flips (most first), then by newest flip.
| Field | Type | Required | Description |
|---|---|---|---|
auto_quarantine |
integer | yes | Flips at which --auto-quarantine catches a test (0 = off), from [tool.rstest] auto-quarantine or the default. |
flaky_tests |
integer | yes | Tests with at least one flip, before --top cut the list. |
meta |
Meta | yes | Envelope metadata. |
tests |
array of FlakyTest | yes | The ranked tests, at most --top of them. |
tests_in_history |
integer | yes | Tests with any recorded run. |
FlakyTest¶
One test that flipped at least once in its recorded history.
| Field | Type | Required | Description |
|---|---|---|---|
auto_quarantined |
boolean | yes | Whether --auto-quarantine quarantines it at the current threshold. |
failed |
integer | yes | Runs that failed (failed, errors, crashed or quarantined). |
flaky |
integer | yes | Runs that passed only on rerun. |
flips |
integer | yes | Flips in the recorded history: a flaky pass, or a failure right after a pass. |
last_flip_epoch |
integer | yes | Epoch seconds of the newest flip. |
nodeid |
string | yes | The test's nodeid. |
outcomes |
array of string | yes | Outcome per run, oldest first (same values as explain's history). |
runs |
integer | yes | Recorded runs of this test. |
trend |
string | yes | failing when the last 3 pass/fail results all failed; otherwise worse / better when the newer half of the history has at least 2 more / fewer flips than the older half, else steady. |
Meta (Flaky)¶
Envelope metadata for the flaky document.
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string | yes | Constant discriminator: always "flaky". |
rstest_version |
string | yes | The rstest version that wrote the document. |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
Flaky: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "FlakyReport",
"description": "The ranked flake view. Tests are sorted by flips (most first), then by\nnewest flip.",
"type": "object",
"properties": {
"auto_quarantine": {
"description": "Flips at which `--auto-quarantine` catches a test (`0` = off), from\n`[tool.rstest] auto-quarantine` or the default.",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"flaky_tests": {
"description": "Tests with at least one flip, before `--top` cut the list.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"meta": {
"description": "Envelope metadata.",
"allOf": [
{
"$ref": "#/definitions/Meta"
}
]
},
"tests": {
"description": "The ranked tests, at most `--top` of them.",
"type": "array",
"items": {
"$ref": "#/definitions/FlakyTest"
}
},
"tests_in_history": {
"description": "Tests with any recorded run.",
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"meta",
"auto_quarantine",
"tests_in_history",
"flaky_tests",
"tests"
],
"definitions": {
"FlakyTest": {
"description": "One test that flipped at least once in its recorded history.",
"type": "object",
"properties": {
"auto_quarantined": {
"description": "Whether `--auto-quarantine` quarantines it at the current threshold.",
"type": "boolean"
},
"failed": {
"description": "Runs that failed (`failed`, `errors`, `crashed` or `quarantined`).",
"type": "integer",
"format": "uint",
"minimum": 0
},
"flaky": {
"description": "Runs that passed only on rerun.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"flips": {
"description": "Flips in the recorded history: a `flaky` pass, or a failure right\nafter a pass.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"last_flip_epoch": {
"description": "Epoch seconds of the newest flip.",
"type": "integer",
"format": "uint64",
"minimum": 0
},
"nodeid": {
"description": "The test's nodeid.",
"type": "string"
},
"outcomes": {
"description": "Outcome per run, oldest first (same values as `explain`'s history).",
"type": "array",
"items": {
"type": "string"
}
},
"runs": {
"description": "Recorded runs of this test.",
"type": "integer",
"format": "uint",
"minimum": 0
},
"trend": {
"description": "`failing` when the last 3 pass/fail results all failed; otherwise\n`worse` / `better` when the newer half of the history has at least 2\nmore / fewer flips than the older half, else `steady`.",
"type": "string"
}
},
"required": [
"nodeid",
"flips",
"trend",
"flaky",
"failed",
"runs",
"outcomes",
"last_flip_epoch",
"auto_quarantined"
]
},
"Meta": {
"description": "Envelope metadata for the flaky document.",
"type": "object",
"properties": {
"kind": {
"description": "Constant discriminator: always `\"flaky\"`.",
"type": "string"
},
"rstest_version": {
"description": "The rstest version that wrote the document.",
"type": "string"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"runner",
"kind",
"schema",
"rstest_version"
]
}
}
}
Since green¶
Source: since-green --json
What differs between the last green run and now.
| Field | Type | Required | Description |
|---|---|---|---|
commit |
string or null | yes | Current HEAD. |
commits |
array of SuspectCommit or null | yes | Commits after the green commit up to HEAD (git log green..HEAD), newest first. Null when there is no commit on either side or git can't resolve the range here. |
dirty |
boolean | yes | The checkout has uncommitted changes now. |
env |
array of Change | yes | Watched environment variables set, unset or changed. |
found |
boolean | yes | Whether a green run was ever recorded here. When it wasn't, only meta, commit and dirty are filled; the rest are empty or null. |
green_commit |
string or null | yes | Commit of the last green run. |
green_epoch |
integer or null | yes | Epoch seconds of the last green run. |
meta |
Meta | yes | Envelope metadata. |
packages |
array of Change | yes | Packages added, removed or at another version, by name. |
python |
Change or null | yes | Interpreter version change, if any. |
Change¶
One value that differs: None on a side means absent there.
| Field | Type | Required | Description |
|---|---|---|---|
green |
string or null | yes | Value at the last green run; null when it was absent (added since). |
name |
string | yes | Package name, environment variable, or python. |
now |
string or null | yes | Value now; null when it is gone (removed since). |
Meta (Since green)¶
Envelope metadata for the since-green document.
| Field | Type | Required | Description |
|---|---|---|---|
kind |
string | yes | Constant discriminator: always "since-green". |
rstest_version |
string | yes | The rstest version that wrote the document. |
runner |
string | yes | Constant producer tag: always "rstest". |
schema |
integer | yes | Document schema version. |
SuspectCommit (Since green)¶
A commit in a suspect range (git log <good>..<bad>).
| Field | Type | Required | Description |
|---|---|---|---|
author |
string | yes | Author name. |
sha |
string | yes | Abbreviated commit hash. |
subject |
string | yes | First line of the commit message. |
Since green: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "SinceGreen",
"description": "What differs between the last green run and now.",
"type": "object",
"properties": {
"commit": {
"description": "Current `HEAD`.",
"type": [
"string",
"null"
]
},
"commits": {
"description": "Commits after the green commit up to `HEAD` (`git log green..HEAD`),\nnewest first. Null when there is no commit on either side or git\ncan't resolve the range here.",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/SuspectCommit"
}
},
"dirty": {
"description": "The checkout has uncommitted changes now.",
"type": "boolean"
},
"env": {
"description": "Watched environment variables set, unset or changed.",
"type": "array",
"items": {
"$ref": "#/definitions/Change"
}
},
"found": {
"description": "Whether a green run was ever recorded here. When it wasn't, only\n`meta`, `commit` and `dirty` are filled; the rest are empty or null.",
"type": "boolean"
},
"green_commit": {
"description": "Commit of the last green run.",
"type": [
"string",
"null"
]
},
"green_epoch": {
"description": "Epoch seconds of the last green run.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0
},
"meta": {
"description": "Envelope metadata.",
"allOf": [
{
"$ref": "#/definitions/Meta"
}
]
},
"packages": {
"description": "Packages added, removed or at another version, by name.",
"type": "array",
"items": {
"$ref": "#/definitions/Change"
}
},
"python": {
"description": "Interpreter version change, if any.",
"anyOf": [
{
"$ref": "#/definitions/Change"
},
{
"type": "null"
}
]
}
},
"required": [
"meta",
"found",
"green_commit",
"green_epoch",
"commit",
"dirty",
"commits",
"python",
"packages",
"env"
],
"definitions": {
"Change": {
"description": "One value that differs: `None` on a side means absent there.",
"type": "object",
"properties": {
"green": {
"description": "Value at the last green run; `null` when it was absent (added since).",
"type": [
"string",
"null"
]
},
"name": {
"description": "Package name, environment variable, or `python`.",
"type": "string"
},
"now": {
"description": "Value now; `null` when it is gone (removed since).",
"type": [
"string",
"null"
]
}
},
"required": [
"name",
"green",
"now"
]
},
"Meta": {
"description": "Envelope metadata for the since-green document.",
"type": "object",
"properties": {
"kind": {
"description": "Constant discriminator: always `\"since-green\"`.",
"type": "string"
},
"rstest_version": {
"description": "The rstest version that wrote the document.",
"type": "string"
},
"runner": {
"description": "Constant producer tag: always `\"rstest\"`.",
"type": "string"
},
"schema": {
"description": "Document schema version.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"runner",
"kind",
"schema",
"rstest_version"
]
},
"SuspectCommit": {
"description": "A commit in a suspect range (`git log <good>..<bad>`).",
"type": "object",
"properties": {
"author": {
"description": "Author name.",
"type": "string"
},
"sha": {
"description": "Abbreviated commit hash.",
"type": "string"
},
"subject": {
"description": "First line of the commit message.",
"type": "string"
}
},
"required": [
"sha",
"author",
"subject"
]
}
}
}
Flake log¶
Source: .rstest_cache/flakes.json
An object mapping each key to a FlakeStats value.
FlakeStats (Flake log)¶
| Field | Type | Required | Description |
|---|---|---|---|
failed |
integer | yes | Runs where the test hard-failed (quarantined failures included). |
flaky |
integer | yes | Runs where the test passed only after rerun(s). |
last_epoch |
integer | yes | Unix epoch of the last recorded event (flake or failure). |
last_failed_epoch |
integer | yes | Unix epoch of the last hard failure. 0 = none, or a cache written before this field existed (readers then fall back to last_epoch when failed is non-zero). |
Flake log: full JSON Schema (draft-07)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Map_of_FlakeStats",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/FlakeStats"
},
"definitions": {
"FlakeStats": {
"type": "object",
"properties": {
"failed": {
"description": "Runs where the test hard-failed (quarantined failures included).",
"type": "integer",
"format": "uint32",
"default": 0,
"minimum": 0
},
"flaky": {
"description": "Runs where the test passed only after rerun(s).",
"type": "integer",
"format": "uint32",
"default": 0,
"minimum": 0
},
"last_epoch": {
"description": "Unix epoch of the last recorded event (flake or failure).",
"type": "integer",
"format": "uint64",
"default": 0,
"minimum": 0
},
"last_failed_epoch": {
"description": "Unix epoch of the last hard failure. 0 = none, or a cache written\nbefore this field existed (readers then fall back to\n`last_epoch` when `failed` is non-zero).",
"type": "integer",
"format": "uint64",
"default": 0,
"minimum": 0
}
},
"required": [
"flaky",
"failed",
"last_epoch",
"last_failed_epoch"
]
}
}
}