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

Show on the map →

Called by none

Calls _repo, _scanned_files

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

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measuredtest_a_declared_scope_bounds_the_parse_built_file_set → _scanned_files → enumerate_tree
REQ-DDB-PIPE-003measuredtest_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
lines 42–42repo, wanted = _repo(tmp_path)lines 43–50args = argparse.Namespace( extra_exclude=[], scope_result=DerivedScope( source=SOURCE_DECLARED, reason="declared in the test", roots=(repo / "src",), ), )lines 52–52scanned = _scanned_files(args, repo)lines 54–57assert 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}" )

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

Show on the map →

Called by none

Calls _repo, _scanned_files

Checks

  • 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" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002measuredtest_an_undeclared_repo_still_walks_itself → _scanned_files → enumerate_tree
REQ-DDB-PIPE-003measuredtest_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
lines 66–66repo, wanted = _repo(tmp_path)lines 67–67args = argparse.Namespace(extra_exclude=[], scope_result=None)lines 69–69scanned = _scanned_files(args, repo)lines 71–71assert wanted in scannedlines 72–74assert any(entry.startswith("node_modules/") for entry in scanned), ( "nothing was declared, so the vendored tree is in scope by default" )

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

Show on the map →

Called by none

Calls _repo, _scanned_files

Checks

  • assert _scanned_files(args, repo) == ["src/main.ts"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-002inferredtest_the_doxygen_stages_own_enumeration_still_wins → _scanned_files → enumerate_tree
REQ-DDB-PIPE-003inferredtest_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

Activity · 3 steps
lines 83–83repo, _ = _repo(tmp_path)lines 84–84args = argparse.Namespace(scanned_files=["src/main.ts"], extra_exclude=[], scope_result=None)lines 86–86assert _scanned_files(args, repo) == ["src/main.ts"]