test_evidence_is_withheld_unless_the_index_is_at_the_pin

Tests › tests/test_wiki_composite.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE PIN RULE, each refusal named: no index -> absent; checkout moved past the pin, or uncommitted changes, or a stale index -> unknown with the reason; all clear -> indexed.

Given

  1. _, pins = _fixture(tmp_path)
  2. lib = tmp_path / "lib"
3 more
  1. db = tmp_path / "lib.db"
  2. db.write_text("")
  3. pin = pins["lib"]
→

When

  1. def probe(locate, stale): return probe_index(lib, pin, pin, locate=locate, is_stale=stale)
  2. state, note, _ = probe(lambda _p: db, lambda *_: True)
  3. (lib / "requirements.yaml").write_text("requirements: {}\n")
3 more
  1. state, note, _ = probe(lambda _p: db, lambda *_: False)
  2. _git(lib, "commit", "-qam", "moved")
  3. state, note, _ = probe(lambda _p: db, lambda *_: False)
→

Then

  1. ✓ probe(lambda _p: None, lambda *_: False)[0] equals "absent"
  2. ✓ probe(lambda _p: db, lambda *_: False)[0] equals "indexed"
  3. ✓ state equals "unknown"
  4. ✓ note contains "older than"
  5. ✓ state equals "unknown"
  6. ✓ note contains "uncommitted"
  7. ✓ state equals "unknown"
  8. ✓ note contains pin[:12]

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.

`main` (clew/guard/main.py) · 3 of 357 steps

… 64 earlier steps

program launcherprogram launcherprogram launcherprogram launcherother filesother filesother filesother filesopt (line 1336)opttry (line 1306)tryalt (line 1344)altmain65–66. read_catalog_at → _refuse_url65_refuse_url +1 more67. git_text → git_argv67git_argv▶ test enters68–69. git_argv → _no_ext_diff68_no_ext_diff +1 more70–71. read_catalog_at → _refuse_url70_refuse_url +1 more

… 286 later steps

4 more

tests/test_wiki_composite.py:160 · its file's page

What it checks (5)

  1. assert probe(lambda _p: None, lambda *_: False)[0] == "absent" not attributed
  2. assert probe(lambda _p: db, lambda *_: False)[0] == "indexed" not attributed
  3. assert state == "unknown" and "older than" in note not attributed
  4. assert state == "unknown" and "uncommitted" in note not attributed
  5. assert state == "unknown" and pin[:12] in note not attributed

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_evidence_is_withheld_unless_the_index_is_at_the_pin→_fixture→probe_index→_git

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_evidence_is_withheld_unless_the_index_is_at_the_pin · 5 checksprobe_indexgit_textgit_argvREQ-DDB-CONFIG-001 · measuredprobe_indexgit_textREQ-DDB-GUARD-027 · measuredprobe_indexREQ-DDB-WIKI-040 · measured
Also reaches 3 requirements

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