test_extra_input_patterns.py

tests/test_extra_input_patterns.py

Tests for gh#3 — `--extra-input` silently defeated by the Doxyfile's FILE_PATTERNS.

test_a_legitimately_empty_root_is_not_flagged

None test_extra_input_patterns.test_a_legitimately_empty_root_is_not_flagged(Path tmp_path)

An empty directory is not a pattern problem and must not fire.

tests/test_extra_input_patterns.py:137

Checks

  • assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["empty"], None, tmp_path) == []
  • assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["absent"], None, tmp_path) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_a_legitimately_empty_root_is_not_flagged → roots_matching_no_file_pattern → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_a_legitimately_empty_root_is_not_flagged → roots_matching_no_file_pattern
Source · 16 lines
def test_a_legitimately_empty_root_is_not_flagged(tmp_path: Path) -> None:
    """A guard that fires on the benign case is worse than no guard. An empty
    directory contributes zero files whatever the patterns say, so blaming
    FILE_PATTERNS for it would be a false alarm — and would train the reader to
    ignore the message in the case that matters.

    An ABSENT root is the same argument: nothing was excluded, there was nothing
    there. (Whether an absent --extra-input root deserves its own complaint is a
    separate question this guard deliberately does not answer.)"""
    doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")
    (tmp_path / "empty").mkdir()

    assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["empty"], None, tmp_path) == []
    assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["absent"], None, tmp_path) == []

Activity · 4 steps
lines 146–146doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")lines 147–147(tmp_path / "empty").mkdir()lines 149–149assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["empty"], None, tmp_path) == []lines 150–150assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["absent"], None, tmp_path) == []

test_a_root_matching_no_pattern_is_flagged

None test_extra_input_patterns.test_a_root_matching_no_pattern_is_flagged(Path tmp_path)

A root whose files match nothing is flagged.

tests/test_extra_input_patterns.py:103

Show on the map →

Called by none

Calls _doxyfile, _flagged, _write, roots_matching_no_file_pattern

Checks

  • assert _flagged(flagged) == ["library"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_a_root_matching_no_pattern_is_flagged → roots_matching_no_file_pattern → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_a_root_matching_no_pattern_is_flagged → roots_matching_no_file_pattern
Source · 19 lines
def test_a_root_matching_no_pattern_is_flagged(tmp_path: Path) -> None:
    """THE GUARD'S QUESTION NARROWED WITH gh#340 and it still has one. It used to be "does the
    target's declared pattern list exclude this root" — impossible now that patterns are
    forced. It is now "does this root contain ANY file doxygen can parse at all", which is
    still reachable and still worth refusing: an `--extra-input` root contributing zero files
    is a flag the operator should be told to drop.

    So the fixture uses `.txt`, which is outside doxygen's 47-extension default. A `.c` root
    would now MATCH — which is the whole point of gh#340 — and a fixture kept on `.c` would
    have tested nothing while looking unchanged.
    """
    doxyfile = _doxyfile(tmp_path, "# patterns are forced; this declaration is ignored")
    _write(tmp_path / "library" / "notes.txt")
    _write(tmp_path / "library" / "README.rst")

    flagged = ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["library"], None, tmp_path)
    assert _flagged(flagged) == ["library"]

Activity · 5 steps
lines 114–114doxyfile = _doxyfile(tmp_path, "# patterns are forced; this declaration is ignored")lines 115–115_write(tmp_path / "library" / "notes.txt")lines 116–116_write(tmp_path / "library" / "README.rst")lines 118–118flagged = ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["library"], None, tmp_path)lines 119–119assert _flagged(flagged) == ["library"]

test_a_root_that_contributes_files_is_not_flagged

None test_extra_input_patterns.test_a_root_that_contributes_files_is_not_flagged(Path tmp_path)

A root that does contribute files is left alone.

tests/test_extra_input_patterns.py:124

Show on the map →

Called by none

Calls _doxyfile, _write, roots_matching_no_file_pattern

Checks

  • assert flagged == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_a_root_that_contributes_files_is_not_flagged → roots_matching_no_file_pattern → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_a_root_that_contributes_files_is_not_flagged → roots_matching_no_file_pattern
Source · 11 lines
def test_a_root_that_contributes_files_is_not_flagged(tmp_path: Path) -> None:
    """The ordinary case must stay silent. One matching file under the root is
    enough — doxygen will read it, so the flag did its job."""
    doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")
    _write(tmp_path / "include" / "aes.h")
    _write(tmp_path / "include" / "notes.txt")

    flagged = ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["include"], None, tmp_path)
    assert flagged == []

Activity · 5 steps
lines 127–127doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")lines 128–128_write(tmp_path / "include" / "aes.h")lines 129–129_write(tmp_path / "include" / "notes.txt")lines 131–131flagged = ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["include"], None, tmp_path)lines 132–132assert flagged == []

test_an_excluded_file_does_not_count_as_a_match

None test_extra_input_patterns.test_an_excluded_file_does_not_count_as_a_match(Path tmp_path)

A file excluded by extra-exclude does not count as a contribution.

tests/test_extra_input_patterns.py:155

Show on the map →

Called by none

Calls _doxyfile, _flagged, _write, roots_matching_no_file_pattern

Checks

  • assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["gen"], None, tmp_path) == []
  • assert _flagged(flagged) == ["gen"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_an_excluded_file_does_not_count_as_a_match → roots_matching_no_file_pattern → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_an_excluded_file_does_not_count_as_a_match → roots_matching_no_file_pattern
Source · 19 lines
def test_an_excluded_file_does_not_count_as_a_match(tmp_path: Path) -> None:
    """The enumeration must honour the same EXCLUDE the build honours, or the
    guard would be satisfied by a file doxygen never reads — the exact
    "it looks like it worked" failure it exists to catch."""
    doxyfile = _doxyfile(tmp_path, "# patterns are forced; this declaration is ignored")
    _write(tmp_path / "gen" / "notes.txt")
    _write(tmp_path / "gen" / "vendor" / "api.h")

    # Without the exclude the vendored header matches, so the root is fine.
    assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["gen"], None, tmp_path) == []
    ## Excluding it leaves only an UNPARSEABLE file. Post-gh#340 the leftover has to be a
    ## `.txt` rather than a `.c`: with patterns forced, a `.c` matches and the root would be
    ## fine, so this test would have passed while exercising nothing.
    flagged = ts.roots_matching_no_file_pattern(
        doxyfile, tmp_path, ["gen"], ["gen/vendor"], tmp_path
    )
    assert _flagged(flagged) == ["gen"]

Activity · 6 steps
lines 159–159doxyfile = _doxyfile(tmp_path, "# patterns are forced; this declaration is ignored")lines 160–160_write(tmp_path / "gen" / "notes.txt")lines 161–161_write(tmp_path / "gen" / "vendor" / "api.h")lines 164–164assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["gen"], None, tmp_path) == []lines 168–170flagged = ts.roots_matching_no_file_pattern( doxyfile, tmp_path, ["gen"], ["gen/vendor"], tmp_path )lines 171–171assert _flagged(flagged) == ["gen"]

test_file_patterns_are_forced_and_the_declaration_is_only_reported

None test_extra_input_patterns.test_file_patterns_are_forced_and_the_declaration_is_only_reported(Path tmp_path)

FILE_PATTERNS is FORCED; the declaration is a reportable fact, not a policy.

tests/test_extra_input_patterns.py:68

Checks

  • assert effective != ["*.h", "*.hpp"], "a declaration must no longer veto the indexed tree"
  • assert "*.c" in effective, "the extension entropic's own census lost must be included"
  • assert declared_file_patterns(declared) == ["*.h", "*.hpp"], "still readable as a FACT"
  • assert effective_file_patterns(silent) == effective, "declared or not, the build is the same"
  • assert declared_file_patterns(silent) == []
  • assert len(effective) > 10

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_file_patterns_are_forced_and_the_declaration_is_only_reported → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_file_patterns_are_forced_and_the_declaration_is_only_reported → effective_file_patterns
Source · 33 lines
def test_file_patterns_are_forced_and_the_declaration_is_only_reported(tmp_path: Path) -> None:
    """THIS TEST'S PREMISE WAS WITHDRAWN BY DECISION (gh#340), so it asserts the opposite of
    what it used to. It used to require that a DECLARED `FILE_PATTERNS` win — and that was the
    defect: scope has three independent keys, `INPUT` is replaced and `EXCLUDE` cleared, so a
    declared extension list was the last one able to veto a tree scope had already admitted.
    Measured on entropic, which declares `*.h *.hpp *.cpp *.md` while the submodule it vendors
    is `.c`/`.cu`/`.m`: the tree was admitted and then silently dropped, exit 0.

    So the build now forces doxygen's own default set, and BOTH halves are asserted — the
    declaration is ignored for the build AND still readable as a fact, because "why does the
    index hold more than the docs do" is a fair question with a real answer.

    @brief The forced set governs; the declaration is reportable.
    @version 2
    """
    declared = _doxyfile(tmp_path / "declared", "FILE_PATTERNS = *.h *.hpp")

    effective = effective_file_patterns(declared)
    assert effective != ["*.h", "*.hpp"], "a declaration must no longer veto the indexed tree"
    assert "*.c" in effective, "the extension entropic's own census lost must be included"
    assert declared_file_patterns(declared) == ["*.h", "*.hpp"], "still readable as a FACT"

    silent = _doxyfile(tmp_path / "silent", "# no FILE_PATTERNS here")
    assert effective_file_patterns(silent) == effective, "declared or not, the build is the same"
    ## Empty, NOT the defaults, when nothing is declared: "not recorded" and "recorded as
    ## doxygen's default" are different claims and only the caller knows which it needs.
    assert declared_file_patterns(silent) == []
    # Not asserted exhaustively — doxygen's default list is doxygen's business and
    # grows between releases. What matters is that it is the broad default set and
    # not an empty list, because empty would flag every root as matching nothing.
    assert len(effective) > 10

Activity · 9 steps
lines 83–83declared = _doxyfile(tmp_path / "declared", "FILE_PATTERNS = *.h *.hpp")lines 85–85effective = effective_file_patterns(declared)lines 86–86assert effective != ["*.h", "*.hpp"], "a declaration must no longer veto the indexed tree"lines 87–87assert "*.c" in effective, "the extension entropic's own census lost must be included"lines 88–88assert declared_file_patterns(declared) == ["*.h", "*.hpp"], "still readable as a FACT"lines 90–90silent = _doxyfile(tmp_path / "silent", "# no FILE_PATTERNS here")lines 91–91assert effective_file_patterns(silent) == effective, "declared or not, the build is the same"lines 94–94assert declared_file_patterns(silent) == []lines 98–98assert len(effective) > 10

test_no_extra_input_is_never_flagged

None test_extra_input_patterns.test_no_extra_input_is_never_flagged(Path tmp_path)

No extra-input at all means nothing to check.

tests/test_extra_input_patterns.py:189

Show on the map →

Called by none

Calls _doxyfile, _write, roots_matching_no_file_pattern

Checks

  • assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, None, None, tmp_path) == []
  • assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, [], None, tmp_path) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001inferredtest_no_extra_input_is_never_flagged → roots_matching_no_file_pattern → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_no_extra_input_is_never_flagged → roots_matching_no_file_pattern
Source · 10 lines
def test_no_extra_input_is_never_flagged(tmp_path: Path) -> None:
    """The guard is scoped to the flag it protects. A build with no --extra-input
    has no root whose contribution was requested, so there is nothing to blame."""
    doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")
    _write(tmp_path / "library" / "aes.c")

    assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, None, None, tmp_path) == []
    assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, [], None, tmp_path) == []

Activity · 4 steps
lines 192–192doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")lines 193–193_write(tmp_path / "library" / "aes.c")lines 195–195assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, None, None, tmp_path) == []lines 196–196assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, [], None, tmp_path) == []

test_pattern_matching_is_case_insensitive

None test_extra_input_patterns.test_pattern_matching_is_case_insensitive(Path tmp_path)

Matching is case-insensitive, which fails toward silence.

tests/test_extra_input_patterns.py:176

Show on the map →

Called by none

Calls _doxyfile, _write, roots_matching_no_file_pattern

Checks

  • assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["include"], None, tmp_path) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_pattern_matching_is_case_insensitive → roots_matching_no_file_pattern → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_pattern_matching_is_case_insensitive → roots_matching_no_file_pattern
Source · 11 lines
def test_pattern_matching_is_case_insensitive(tmp_path: Path) -> None:
    """`*.h` against `AES.H`. The two possible errors here are not symmetric: a
    false alarm refuses a build that would have worked, a missed case leaves the
    pre-existing silent behaviour. Case-insensitive matching admits MORE files and
    therefore flags FEWER roots, which is the safe direction for a hard failure."""
    doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")
    _write(tmp_path / "include" / "AES.H")

    assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["include"], None, tmp_path) == []

Activity · 3 steps
lines 181–181doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")lines 182–182_write(tmp_path / "include" / "AES.H")lines 184–184assert ts.roots_matching_no_file_pattern(doxyfile, tmp_path, ["include"], None, tmp_path) == []

test_scope_derived_roots_are_not_subject_to_the_guard

None test_extra_input_patterns.test_scope_derived_roots_are_not_subject_to_the_guard(Path tmp_path)

A derived scope root is never judged by this guard.

tests/test_extra_input_patterns.py:279

Show on the map →

Called by none

Calls _apply_scope, _doxyfile, _verify_extra_input_is_read, _write

Checks

  • assert args.extra_input == [str(tmp_path)], "the resolved scope injects the repo root"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_scope_derived_roots_are_not_subject_to_the_guard → _verify_extra_input_is_read → effective_file_patterns
REQ-DDB-GUARD-012inferredtest_scope_derived_roots_are_not_subject_to_the_guard → _apply_scope → declared_scope_rejection → _declared_index_scope → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node
REQ-DDB-INDEX-001measuredtest_scope_derived_roots_are_not_subject_to_the_guard → _verify_extra_input_is_read → effective_file_patterns
REQ-DDB-WIKI-054inferredtest_scope_derived_roots_are_not_subject_to_the_guard → _apply_scope → declared_scope_rejection → _declared_index_scope → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all
Source · 32 lines
def test_scope_derived_roots_are_not_subject_to_the_guard(tmp_path: Path) -> None:
    """`_apply_scope` PREPENDS the derived scope roots — and on the whole-repo
    fallback the repo root itself — into the same `args.extra_input` list the user's
    entries live in. Judging the mutated list would refuse builds over roots the
    user never named, so the guard must run against the user's own entries only.

    Asserted at the boundary that makes it true: after `_apply_scope` has injected a
    root that matches nothing, the check still passes when the USER named nothing."""
    import argparse

    from clew import cli

    doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")
    _write(tmp_path / "library" / "aes.c")

    args = argparse.Namespace(
        doxyfile=str(doxyfile),
        repo_root=str(tmp_path),
        ## from-guard, not doxyfile: gh#333 made this the default and removed the
        ## `index_whole_repo` back door that used to reach the same scope from the
        ## narrow setting — two paths to one scope being two things that can disagree.
        scope=cli.SCOPE_FROM_GUARD,
        guard_config=None,
        extra_input=None,
        extra_exclude=None,
    )
    cli._apply_scope(args, tmp_path)
    assert args.extra_input == [str(tmp_path)], "the resolved scope injects the repo root"
    # The injected root holds only .c files behind a *.h pattern, yet must not refuse.
    cli._verify_extra_input_is_read(doxyfile, None, None, tmp_path)

Activity · 8 steps
lines 287–287import argparselines 289–289from clew import clilines 291–291doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")lines 292–292_write(tmp_path / "library" / "aes.c")lines 294–304args = argparse.Namespace( doxyfile=str(doxyfile), repo_root=str(tmp_path), ## from-guard, not doxyfile: gh#333 made this the default and removed the ## `index_whole_repo` back door that used to reach the same scope from the ## narrow setting — two paths to one scope being two things that can disagree. scope=cli.SCOPE_FROM_GUARD, guard_config=None, extra_input=None, extra_exclude=None, )lines 305–305cli._apply_scope(args, tmp_path)lines 306–306assert args.extra_input == [str(tmp_path)], "the resolved scope injects the repo root"lines 308–308cli._verify_extra_input_is_read(doxyfile, None, None, tmp_path)

test_the_check_is_silent_when_the_root_contributes

None test_extra_input_patterns.test_the_check_is_silent_when_the_root_contributes(Path tmp_path)

A passing check returns without raising.

tests/test_extra_input_patterns.py:226

Show on the map →

Called by none

Calls _doxyfile, _verify_extra_input_is_read, _write

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_the_check_is_silent_when_the_root_contributes → _verify_extra_input_is_read → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_the_check_is_silent_when_the_root_contributes → _verify_extra_input_is_read → effective_file_patterns
Source · 10 lines
def test_the_check_is_silent_when_the_root_contributes(tmp_path: Path) -> None:
    """The guard must be invisible on every build that already worked."""
    from clew.cli import _verify_extra_input_is_read

    doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")
    _write(tmp_path / "include" / "aes.h")

    _verify_extra_input_is_read(doxyfile, ["include"], None, tmp_path)

Activity · 4 steps
lines 228–228from clew.cli import _verify_extra_input_is_readlines 230–230doxyfile = _doxyfile(tmp_path, "FILE_PATTERNS = *.h")lines 231–231_write(tmp_path / "include" / "aes.h")lines 233–233_verify_extra_input_is_read(doxyfile, ["include"], None, tmp_path)

test_the_guard_runs_before_the_scope_is_folded_in

None test_extra_input_patterns.test_the_guard_runs_before_the_scope_is_folded_in(Path tmp_path, monkeypatch)

The guard runs BEFORE _apply_scope, so derived roots are never judged.

tests/test_extra_input_patterns.py:313

Show on the map →

Called by none

Calls _doxyfile, _run_pipeline, _write

Checks

  • assert args.extra_input, "the derived scope must have been folded in after the guard"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CLI-001inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → report_stats
REQ-DDB-CLI-002inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → _doxygen_or_partial → _doxygen_stage → _run_doxygen_from_args → run_doxygen → doxygen_supports_sqlite3
REQ-DDB-CONFIG-001measuredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _apply_declared_document → stated_document_meta
REQ-DDB-CONFIG-003inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml → _is_flat_req_list
REQ-DDB-CONFIG-004inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_preprocessor
REQ-DDB-CONFIG-005inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig
REQ-DDB-CONFIG-006measuredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _recorded_entry_patterns → recorded_explicit
REQ-DDB-CONFIG-007inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature
REQ-DDB-CONFIG-009measuredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _apply_toolchain_exclusions → load_toolchain_config
REQ-DDB-GUARD-012inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → load_guard_config → read_guard_config → read_requirements_section
REQ-DDB-GUARD-019inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → apply_autobrief
REQ-DDB-INDEX-001measuredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _verify_extra_input_is_read → effective_file_patterns
REQ-DDB-INDEX-002measuredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → build_lock
REQ-DDB-INDEX-003inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → report_index_coverage
REQ-DDB-INDEX-004inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols
REQ-DDB-INDEX-005inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → stamp_external_provenance
REQ-DDB-INDEX-006inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → record_code_text → code_text_rows
REQ-DDB-INDEX-007inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → record_owners
REQ-DDB-INDEX-008inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_licenses
REQ-DDB-INDEX-009inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc
REQ-DDB-INDEX-010inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes
REQ-DDB-INDEX-011inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_property_keys
REQ-DDB-MCP-001measuredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _operator_excludes → meta_section
REQ-DDB-MCP-004measured
REQ-DDB-PIPE-001inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_database
REQ-DDB-PIPE-003inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → build_call_edges
REQ-DDB-PIPE-004inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → python_entry_seeds
REQ-DDB-PIPE-005inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature
REQ-DDB-PIPE-006inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → run_rustdoc → _require_nightly_rustdoc → clean_subprocess_env
REQ-DDB-PIPE-007inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig_gates
REQ-DDB-PIPE-008inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs
REQ-DDB-PIPE-009inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → prune_dominated_fuzzy_call_edges
REQ-DDB-PIPE-010inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _build_inferred_edges
REQ-DDB-PIPE-011inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes → run_harvest → _harvest_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → build_harvest_plan → js_symbol_harvester
REQ-DDB-PIPE-013inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings
REQ-DDB-PIPE-014inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc → within_repo
REQ-DDB-PIPE-015inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_config_defaults
REQ-DDB-QUERY-003inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → mark_test_scope
REQ-DDB-QUERY-011inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads → _ensure_threads_tables
REQ-DDB-SCHEMA-001inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads
REQ-DDB-SCHEMA-002inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _writer_dispatch_map
REQ-DDB-SCHEMA-003inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table
REQ-DDB-SCHEMA-004inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest
REQ-DDB-SCHEMA-005inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_key_alias_prefixes
REQ-DDB-SCHEMA-006inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml
REQ-DDB-SCHEMA-007inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table
REQ-DDB-SCHEMA-009inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_event_edges
REQ-DDB-SCHEMA-011inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → extract_context_conflicts
REQ-DDB-SCHEMA-012inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest → declaration_origin
REQ-DDB-SCHEMA-013inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → import_data_model_keys
REQ-DDB-SCHEMA-014inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs → ensure_file_docs_table
REQ-DDB-SCHEMA-015inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml
REQ-DDB-WIKI-054inferredtest_the_guard_runs_before_the_scope_is_folded_in → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols → _recover_into → all
Source · 58 lines
def test_the_guard_runs_before_the_scope_is_folded_in(tmp_path: Path, monkeypatch) -> None:
    """The ORDERING is the mechanism, and it is invisible to any test that calls the
    check directly — swapping the two lines in `_run_pipeline` leaves every other
    test green while turning a working build into a refusal. So this drives
    `_run_pipeline` on the shape that distinguishes them: a repo whose DERIVED scope
    root holds only `.c` files behind a `FILE_PATTERNS = *.h` Doxyfile, with the user
    naming no --extra-input at all.

    Correct order → nothing to judge, the build proceeds. Reversed → the derived root
    is mistaken for a user request and the build is refused over a flag nobody passed.

    `_build_stages` is stubbed to a sentinel because the assertion is about which of
    the two outcomes the resolution prefix reaches, not about doxygen: reaching the
    sentinel IS the evidence the guard let the build through."""
    import argparse

    from clew import cli

    repo = tmp_path / "repo"
    repo.mkdir()
    (repo / ".pre-commit-config.yaml").write_text(
        "repos:\n"
        "  - repo: https://example.invalid/doxygen-guard\n"
        "    rev: v1\n"
        "    hooks:\n"
        "      - id: doxygen-guard\n"
        "        files: ^src/.*\\.(c|h)$\n",
        encoding="utf-8",
    )
    (repo / ".clew.yaml").write_text("index_scope:\n  roots: [src]\n", encoding="utf-8")
    _write(repo / "src" / "only_impl.c")
    doxyfile = _doxyfile(repo, "FILE_PATTERNS = *.h")

    class _Reached(Exception):
        """@brief Sentinel proving the build got past the guard."""

    ## @brief Stand in for the build stages.
    ## @version 1
    def _sentinel(*_a, **_k) -> None:
        """@brief Raise the sentinel instead of building."""
        raise _Reached

    monkeypatch.setattr(cli, "_build_stages", _sentinel)

    args = argparse.Namespace(
        doxyfile=str(doxyfile),
        output=str(tmp_path / "out" / "clew.db"),
        repo_root=str(repo),
        scope=cli.SCOPE_FROM_GUARD,
        guard_config=None,
        extra_input=None,
        extra_exclude=None,
        rebuild=True,
        no_index_cache=True,
    )
    with pytest.raises(_Reached):
        cli._run_pipeline(args)
    assert args.extra_input, "the derived scope must have been folded in after the guard"

1 more lines, not shown

Activity · 15 steps
lines 327–327import argparselines 329–329from clew import clilines 331–331repo = tmp_path / "repo"lines 332–332repo.mkdir()lines 333–341(repo / ".pre-commit-config.yaml").write_text( "repos:\n" " - repo: https://example.invalid/doxygen-guard\n" " rev: v1\n" " hooks:\n" " - id: doxygen-guard\n" " files: ^src/.*\\.(c|h)$\n", encoding="utf-8", )lines 342–342(repo / ".clew.yaml").write_text("index_scope:\n roots: [src]\n", encoding="utf-8")lines 343–343_write(repo / "src" / "only_impl.c")lines 344–344doxyfile = _doxyfile(repo, "FILE_PATTERNS = *.h")lines 346–347class _Reached(Exception): """@brief Sentinel proving the build got past the guard."""lines 351–353def _sentinel(*_a, **_k) -> None: """@brief Raise the sentinel instead of building.""" raise _Reachedlines 355–355monkeypatch.setattr(cli, "_build_stages", _sentinel)lines 357–367args = argparse.Namespace( doxyfile=str(doxyfile), output=str(tmp_path / "out" / "clew.db"), repo_root=str(repo), scope=cli.SCOPE_FROM_GUARD, guard_config=None, extra_input=None, extra_exclude=None, rebuild=True, no_index_cache=True, )lines 368–368with pytest.raises(_Reached)lines 369–369cli._run_pipeline(args)lines 370–370assert args.extra_input, "the derived scope must have been folded in after the guard"

test_the_pipeline_refuses_before_running_doxygen

None test_extra_input_patterns.test_the_pipeline_refuses_before_running_doxygen(Path tmp_path, caplog)

The guard is actually WIRED into the pipeline, not merely correct.

tests/test_extra_input_patterns.py:238

Show on the map →

Called by none

Calls _doxyfile, _run_pipeline, _write

Checks

  • assert excinfo.value.code == 1
  • assert "contributes NOTHING" in caplog.text
  • assert "*.h" in caplog.text

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CLI-001inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → report_stats
REQ-DDB-CLI-002inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → _doxygen_or_partial → _doxygen_stage → _run_doxygen_from_args → run_doxygen → doxygen_supports_sqlite3
REQ-DDB-CONFIG-001measuredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _apply_declared_document → stated_document_meta
REQ-DDB-CONFIG-003inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml → _is_flat_req_list
REQ-DDB-CONFIG-004inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_preprocessor
REQ-DDB-CONFIG-005inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig
REQ-DDB-CONFIG-006measuredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _recorded_entry_patterns → recorded_explicit
REQ-DDB-CONFIG-007inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature
REQ-DDB-CONFIG-009inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _apply_toolchain_exclusions → load_toolchain_config
REQ-DDB-GUARD-012inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → load_guard_config → read_guard_config → read_requirements_section
REQ-DDB-GUARD-019inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings → summarize → apply_autobrief
REQ-DDB-INDEX-001measuredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _verify_extra_input_is_read → effective_file_patterns
REQ-DDB-INDEX-002measuredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → build_lock
REQ-DDB-INDEX-003inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → report_index_coverage
REQ-DDB-INDEX-004inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols
REQ-DDB-INDEX-005inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → stamp_external_provenance
REQ-DDB-INDEX-006inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → record_code_text → code_text_rows
REQ-DDB-INDEX-007inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → record_owners
REQ-DDB-INDEX-008inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_licenses
REQ-DDB-INDEX-009inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc
REQ-DDB-INDEX-010inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes
REQ-DDB-INDEX-011inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_property_keys
REQ-DDB-MCP-001measuredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _operator_excludes → meta_section
REQ-DDB-MCP-004measured
REQ-DDB-PIPE-001inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_database
REQ-DDB-PIPE-003inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → build_call_edges
REQ-DDB-PIPE-004inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → python_entry_seeds
REQ-DDB-PIPE-005inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → write_build_signature
REQ-DDB-PIPE-006inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → run_rustdoc → _require_nightly_rustdoc → clean_subprocess_env
REQ-DDB-PIPE-007inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_kconfig_gates
REQ-DDB-PIPE-008inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs
REQ-DDB-PIPE-009inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → prune_dominated_fuzzy_call_edges
REQ-DDB-PIPE-010inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _build_inferred_edges
REQ-DDB-PIPE-011inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_ast_includes → run_harvest → _harvest_one_file → _parseable_file
REQ-DDB-PIPE-012inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → build_harvest_plan → js_symbol_harvester
REQ-DDB-PIPE-013inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → enrich_python_docstrings
REQ-DDB-PIPE-014inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_kerneldoc → within_repo
REQ-DDB-PIPE-015inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_config_defaults
REQ-DDB-QUERY-003inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → mark_test_scope
REQ-DDB-QUERY-011inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads → _ensure_threads_tables
REQ-DDB-SCHEMA-001inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → extract_threads
REQ-DDB-SCHEMA-002inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_shared_key_edges_inferred → _writer_dispatch_map
REQ-DDB-SCHEMA-003inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table
REQ-DDB-SCHEMA-004inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest
REQ-DDB-SCHEMA-005inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → resolve_key_alias_prefixes
REQ-DDB-SCHEMA-006inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml
REQ-DDB-SCHEMA-007inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_callback_registration_edges → _ensure_external_boundaries_table
REQ-DDB-SCHEMA-009inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_event_edges
REQ-DDB-SCHEMA-011inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → extract_context_conflicts
REQ-DDB-SCHEMA-012inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → load_dispatch_manifest → declaration_origin
REQ-DDB-SCHEMA-013inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → import_data_model_keys
REQ-DDB-SCHEMA-014inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_file_docs → ensure_file_docs_table
REQ-DDB-SCHEMA-015inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → ingest_requirements_yaml
REQ-DDB-WIKI-054inferredtest_the_pipeline_refuses_before_running_doxygen → _run_pipeline → _run_pipeline_inner → _build_stages → recover_ast_symbols → _recover_into → all
Source · 39 lines
def test_the_pipeline_refuses_before_running_doxygen(tmp_path: Path, caplog) -> None:
    """A check that is right in isolation and never called changes nothing a user
    sees — and an unwired guard is indistinguishable from the silent no-op it
    replaced, which is precisely gh#3. This drives the real entry point.

    It also pins the ORDER: the refusal must land before doxygen is spawned, so a
    doxygen binary is not a prerequisite for the guard to fire. `_run_pipeline`
    would need one to get any further, so reaching SystemExit(1) with the gh#3
    message is itself the evidence that nothing was built."""
    import argparse

    from clew import cli

    ## `.txt`, post-gh#340, and this fixture is why the ORDER assertion below is not decorative.
    ## With a `.c` root the forced patterns MATCH, the guard does not fire, `_run_pipeline` walks
    ## on past it — and the test then failed with `AttributeError: 'Namespace' object has no
    ## attribute 'no_index_cache'`, from this hand-built Namespace, several stages downstream.
    ## That error looked like an unrelated fixture defect and was in fact the guard not firing.
    doxyfile = _doxyfile(tmp_path, "# patterns are forced; this declaration is ignored")
    _write(tmp_path / "library" / "notes.txt")

    args = argparse.Namespace(
        doxyfile=str(doxyfile),
        output=str(tmp_path / "out" / "clew.db"),
        repo_root=str(tmp_path),
        ## From `scope`, the owning module. The 22->6 collapse deleted the `--scope` flag
        ## whose `choices=` was the only reason this constant was imported into `cli`.
        scope=SCOPE_DOXYFILE,
        guard_config=None,
        extra_input=["library"],
        extra_exclude=None,
    )
    with caplog.at_level("ERROR"), pytest.raises(SystemExit) as excinfo:
        cli._run_pipeline(args)
    assert excinfo.value.code == 1
    assert "contributes NOTHING" in caplog.text
    assert "*.h" in caplog.text

Activity · 10 steps
lines 247–247import argparselines 249–249from clew import clilines 256–256doxyfile = _doxyfile(tmp_path, "# patterns are forced; this declaration is ignored")lines 257–257_write(tmp_path / "library" / "notes.txt")lines 259–269args = argparse.Namespace( doxyfile=str(doxyfile), output=str(tmp_path / "out" / "clew.db"), repo_root=str(tmp_path), ## From `scope`, the owning module. The 22->6 collapse deleted the `--scope` flag ## whose `choices=` was the only reason this constant was imported into `cli`. scope=SCOPE_DOXYFILE, guard_config=None, extra_input=["library"], extra_exclude=None, )lines 270–270with caplog.at_level("ERROR"), pytest.raises(SystemExit) as excinfolines 271–271cli._run_pipeline(args)lines 272–272assert excinfo.value.code == 1lines 273–273assert "contributes NOTHING" in caplog.textlines 274–274assert "*.h" in caplog.text

test_the_refusal_names_the_root_and_the_patterns

None test_extra_input_patterns.test_the_refusal_names_the_root_and_the_patterns(Path tmp_path, caplog)

The CLI refusal names the root AND the patterns that excluded it.

tests/test_extra_input_patterns.py:201

Show on the map →

Called by none

Calls _doxyfile, _verify_extra_input_is_read, _write

Checks

  • assert excinfo.value.code == 1
  • assert "library" in message, "the message must name the root the user passed"
  • assert "*.h" in message, "the message must name the patterns that excluded it"
  • assert "FILE_PATTERNS" in message, "the message must name the key to widen"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_the_refusal_names_the_root_and_the_patterns → _verify_extra_input_is_read → effective_file_patterns
REQ-DDB-INDEX-001measuredtest_the_refusal_names_the_root_and_the_patterns → _verify_extra_input_is_read → effective_file_patterns
Source · 23 lines
def test_the_refusal_names_the_root_and_the_patterns(tmp_path: Path, caplog) -> None:
    """ "Done means" for gh#3: an --extra-input root that contributes nothing is an
    error naming the pattern that excluded it, not a silent no-op. Both halves are
    load-bearing — the root tells the user which flag to drop, the patterns tell
    them what to widen, and either alone leaves them guessing."""
    from clew.cli import _verify_extra_input_is_read

    doxyfile = _doxyfile(tmp_path, "# patterns are forced; this declaration is ignored")
    _write(tmp_path / "library" / "notes.txt")

    with caplog.at_level("ERROR"), pytest.raises(SystemExit) as excinfo:
        _verify_extra_input_is_read(doxyfile, ["library"], None, tmp_path)
    assert excinfo.value.code == 1

    message = caplog.text
    assert "library" in message, "the message must name the root the user passed"
    ## The patterns it names are now the FORCED set, so `*.h` still appears — but for a
    ## different reason than before gh#340, and the assertion is kept because the message's
    ## job is unchanged: tell the operator what doxygen will actually match.
    assert "*.h" in message, "the message must name the patterns that excluded it"
    assert "FILE_PATTERNS" in message, "the message must name the key to widen"

Activity · 10 steps
lines 206–206from clew.cli import _verify_extra_input_is_readlines 208–208doxyfile = _doxyfile(tmp_path, "# patterns are forced; this declaration is ignored")lines 209–209_write(tmp_path / "library" / "notes.txt")lines 211–211with caplog.at_level("ERROR"), pytest.raises(SystemExit) as excinfolines 212–212_verify_extra_input_is_read(doxyfile, ["library"], None, tmp_path)lines 213–213assert excinfo.value.code == 1lines 215–215message = caplog.textlines 216–216assert "library" in message, "the message must name the root the user passed"lines 220–220assert "*.h" in message, "the message must name the patterns that excluded it"lines 221–221assert "FILE_PATTERNS" in message, "the message must name the key to widen"