test_scanned_files.py¶
tests/test_scanned_files.py
The file set the parse-built front end is handed must be the file set the build declared.
test_a_declared_scope_bounds_the_parse_built_file_set
None test_scanned_files.test_a_declared_scope_bounds_the_parse_built_file_set(Path tmp_path)
A declared root excludes everything outside it.
tests/test_scanned_files.py:40
Checks
assert scanned == [wanted], ("the parse-built front end was handed files outside the declared scope, so the " f"`path` table publishes a tree the owner excluded: {scanned}" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | measured | test_a_declared_scope_bounds_the_parse_built_file_set → _scanned_files → enumerate_tree |
| REQ-DDB-PIPE-003 | measured | test_a_declared_scope_bounds_the_parse_built_file_set → _scanned_files → enumerate_tree → rel_key |
Source · 20 lines
def test_a_declared_scope_bounds_the_parse_built_file_set(tmp_path: Path) -> None:
"""@brief A declared root excludes everything outside it. @version 1"""
repo, wanted = _repo(tmp_path)
args = argparse.Namespace(
extra_exclude=[],
scope_result=DerivedScope(
source=SOURCE_DECLARED,
reason="declared in the test",
roots=(repo / "src",),
),
)
scanned = _scanned_files(args, repo)
assert scanned == [wanted], (
"the parse-built front end was handed files outside the declared scope, so the "
f"`path` table publishes a tree the owner excluded: {scanned}"
)
Activity · 4 steps
test_an_undeclared_repo_still_walks_itself
None test_scanned_files.test_an_undeclared_repo_still_walks_itself(Path tmp_path)
With no declared roots the walk is the repo.
tests/test_scanned_files.py:60
Checks
assert wanted in scannedassert any(entry.startswith("node_modules/") for entry in scanned), ("nothing was declared, so the vendored tree is in scope by default" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | measured | test_an_undeclared_repo_still_walks_itself → _scanned_files → enumerate_tree |
| REQ-DDB-PIPE-003 | measured | test_an_undeclared_repo_still_walks_itself → _scanned_files → enumerate_tree → rel_key |
Source · 17 lines
def test_an_undeclared_repo_still_walks_itself(tmp_path: Path) -> None:
"""THE CONTROL. Saying nothing still means the whole repository — the fix must bound a
declaration, not quietly narrow every build that made none.
@brief With no declared roots the walk is the repo. @version 1
"""
repo, wanted = _repo(tmp_path)
args = argparse.Namespace(extra_exclude=[], scope_result=None)
scanned = _scanned_files(args, repo)
assert wanted in scanned
assert any(entry.startswith("node_modules/") for entry in scanned), (
"nothing was declared, so the vendored tree is in scope by default"
)
Activity · 5 steps
test_the_doxygen_stages_own_enumeration_still_wins
None test_scanned_files.test_the_doxygen_stages_own_enumeration_still_wins(Path tmp_path)
A stashed scanned set is returned verbatim.
tests/test_scanned_files.py:77
Checks
assert _scanned_files(args, repo) == ["src/main.ts"]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-002 | inferred | test_the_doxygen_stages_own_enumeration_still_wins → _scanned_files → enumerate_tree |
| REQ-DDB-PIPE-003 | inferred | test_the_doxygen_stages_own_enumeration_still_wins → _scanned_files → enumerate_tree → rel_key |
Source · 10 lines
def test_the_doxygen_stages_own_enumeration_still_wins(tmp_path: Path) -> None:
"""When doxygen ran it already enumerated under the scope AND dropped binaries; re-walking
here would undo `_drop_binary_files`.
@brief A stashed scanned set is returned verbatim. @version 1
"""
repo, _ = _repo(tmp_path)
args = argparse.Namespace(scanned_files=["src/main.ts"], extra_exclude=[], scope_result=None)
assert _scanned_files(args, repo) == ["src/main.ts"]1 more lines, not shown