test_excluded_subtree_is_never_visited¶
Tests › tests/test_treescan_pruning.py
What this test is for
Why it exists
The STRUCTURAL half. Equal output sets would also hold for enumerate-then-filter, so membership alone cannot show the walk got smaller; this records every directory the walk actually yielded.
Given
roots, excludes = _make_scan_tree(tmp_path)visited: list[str] = []
3 more
real_walk = os.walkdef spy(top, **kwargs): for dirpath, dirnames, filenames in real_walk(top, **kwargs): visited.append(dirpath) yield dirpath, dirnames, filenamesmonkeypatch.setattr(ts.os, "walk", spy)
When
ts.enumerate_tree(roots, excludes, tmp_path)
Then
- ✓ visited contains str(tmp_path / "src")
- ✓ visited does not contain str(tmp_path / "vendored")
- ✓ visited does not contain str(tmp_path / "vendored" / "deep")
- ✓ visited does not contain str(tmp_path / ".cache")
tests/test_treescan_pruning.py:123 · its file's page
What it checks (4)
assert str(tmp_path / "src") in visitednot attributedassert str(tmp_path / "vendored") not in visitednot attributedassert str(tmp_path / "vendored" / "deep") not in visitednot attributedassert str(tmp_path / ".cache") not in visitednot 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
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.
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-002 measured
- REQ-DDB-PIPE-003 measured