test_the_repository_and_home_paths_are_redacted

Tests › tests/test_wiki_trace_redact.py

passed Passed in the packaged run.

What this test is for

Why it exists

`<repo>` for the repository, `~` for the home directory; the key untouched.

Given

  1. home = tmp_path / "home" / "dev"
  2. repo = home / "work" / "proj"
4 more
  1. (repo / "traces").mkdir(parents=True)
  2. monkeypatch.setenv("HOME", str(home))
  3. value = f"[PosixPath('{repo}/src/a.py'), '{home}/.cache/x']"
  4. (repo / "traces" / "t.json").write_text(json.dumps(_span(value)))
→

When

  1. [(rel, otlp)] = load_traces(repo, ("traces/*.json",))
  2. attr = otlp["resourceSpans"][0]["scopeSpans"][0]["spans"][0]["attributes"][0]
→

Then

  1. ✓ attr["key"] equals "code.return"
  2. ✓ attr["value"]["stringValue"] equals "[PosixPath('<repo>/src/a.py'), '~/.cache/x']"
  3. ✓ json.dumps(otlp) does not contain str(home)

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

… 81 earlier steps

callercallercallercallerclew/wiki/build.pyclew/wiki/build.pyclew/wiki/build.pyclew/wiki/build.pyother filesother filesother filesother filesloop (line 281)loopbuild_wiki82. _build_site → gather82gather83. _build_site → load_traces83load_traces84. load_traces → redact_local_paths84redact_local_paths▶ test enters85. _build_site → root_name85root_name86. root_name → spans_of86spans_of

… 314 later steps

tests/test_wiki_trace_redact.py:43 · its file's page

What it checks (3)

  1. assert attr["key"] == "code.return" not attributed
  2. assert attr["value"]["stringValue"] == "[PosixPath('<repo>/src/a.py'), '~/.cache/x']" not attributed
  3. assert str(home) not in json.dumps(otlp) not attributed

Where the product reaches it

  • build_wiki → _build_site → load_traces (flow)

Call flow

test_the_repository_and_home_paths_are_redacted→_span→load_traces

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_the_repository_and_home_paths_are_redacted · 3 checksload_tracesREQ-DDB-WIKI-036 · measuredload_tracesredact_local_pathsREQ-DDB-WIKI-049 · measured
Also reaches 2 requirements

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