test_contexts_are_read_from_coverage_s_own_data_file

Tests › tests/test_wiki_imports.py

passed Passed in the packaged run.

What this test is for

Why it exists

FOUND ON CLEW'S OWN SUITE (round 4): the JSON report with per-test contexts was 3.9 GB for 3,176 tests — every line repeating every test that ran it. coverage.py's data file holds the same contexts compactly (SQLite), so `contexts:` also takes it, read through coverage's API.

Verifies REQ-DDB-WIKI-009

Given

  1. data = CoverageData(basename=str(tmp_path / ".coverage"))
  2. data.set_context("tests/unit/test_c.py::test_cov|run")
5 more
  1. data.add_lines({str(tmp_path / "src" / "a.c"): [11]})
  2. data.set_context("tests/unit/test_c.py::test_elsewhere|run")
  3. data.add_lines({str(tmp_path / "src" / "a.c"): [40]})
  4. data.write()
  5. inputs = EvidenceInputs(contexts=".coverage", infer_depth=0)
→

When

  1. rows = { r.req_id: r for r in requirement_evidence(traced, junit=[], inputs=inputs, repo_root=tmp_path) }
→

Then

  1. ✓ rows["R-A"].measured_tests equals ("test_cov",)

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 · 5 of 400 steps

… 133 earlier steps

callercallercallercallerother filesother filesother filesother filesloop (line 259)loopelif (line 264)elifopt (line 202)optloop (line 292)looploop (line 204)loopbuild_wiki134. _text → check_report_size134check_report_size135. _contexts_from_lcov → _relative135_relative136. parse_contexts → _contexts_from_data_file136_contexts_from_data_file▶ test enters137–138. _contexts_from_data_file → _relative137_relative +1 more139–140. parse_contexts → _text139_text +1 more

… 204 steps between

callercallercallercallerclew/wiki/build.pyclew/wiki/build.pyclew/wiki/build.pyclew/wiki/build.pyother filesother filesother filesother filesbuild_wiki345. slice_svg → _hidden345_hidden346. _build_site → parse_junit346parse_junit347. parse_junit → fold_cases347fold_cases▶ test enters348. fold_cases → _folded348_folded349–350. parse_junit → _case_name349_case_name +1 more

… 50 later steps

tests/test_wiki_imports.py:549 · its file's page

What it checks (1)

  1. assert rows["R-A"].measured_tests == ("test_cov",) observes requirement_evidence via rows

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

test_contexts_are_read_from_coverage_s_own_data_file→requirement_evidence

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.

test_contexts_are_read_from_coverage_s_own_data_file · 1 checksrequirement_evidenceconnectREQ-DDB-QUERY-001 · measuredrequirement_evidence_implementer_spanstable_existsREQ-DDB-QUERY-003 · measuredrequirement_evidenceREQ-DDB-WIKI-002 · measuredrequirement_evidence_tierallREQ-DDB-WIKI-054 · inferred

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-WIKI-009catalogunknown
Also reaches 11 requirements

Its run touches their code; that is reach, not proof.