test_per_test_coverage_contexts_link_tests_by_measurement¶
Tests › tests/test_wiki_imports.py
What this test is for
Why it exists
MEASURED, NOT INFERRED: coverage.py run with `--cov-context=test` records which test ran each line; a test that ran a line inside an implementer's body is linked to its requirement.
Verifies REQ-DDB-WIKI-009
Given
report = tmp_path / "coverage.json"report.write_text( json.dumps( { "files": { "src/a.c": { "contexts": { "11": ["tests/unit/test_c.py::test_cov[1]|run", ""], "40": ["tests/unit/test_c.py::test_elsewhere|run"], } } } } ) )inputs = EvidenceInputs(contexts="coverage.json", infer_depth=0)
When
rows = { r.req_id: r for r in requirement_evidence(traced, junit=[], inputs=inputs, repo_root=tmp_path) }
Then
- ✓ rows["R-A"].measured_tests equals ("test_cov",)
- ✓ {t for t, _s in rows["R-A"].tests} does not contain "test_elsewhere"
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
Build this wiki from the index · 6 of 400 steps
… 131 earlier steps
… 201 steps between
… 50 later steps
tests/test_wiki_imports.py:451 · its file's page
What it checks (2)
assert rows["R-A"].measured_tests == ("test_cov",)observesrequirement_evidenceviarowsassert "test_elsewhere" not in {t for t, _s in rows["R-A"].tests}observesrequirement_evidenceviarows
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-WIKI-009 | catalog | unknown |
Also reaches 11 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-QUERY-001 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-SCHEMA-006 measured
- REQ-DDB-WIKI-002 measured
- REQ-DDB-WIKI-010 measured
- REQ-DDB-WIKI-015 measured
- REQ-DDB-WIKI-016 measured
- REQ-DDB-WIKI-017 measured
- REQ-DDB-WIKI-041 measured
- REQ-DDB-WIKI-054 inferred