test_declared_doxyfile.py

tests/test_declared_doxyfile.py

A `doxyfile:` in the checked-in `.clew.yaml` is read, and OVERVIEW's example is loadable (R5-CFG F2/F3).

test_a_declared_doxyfile_outside_the_repo_is_refused

None test_declared_doxyfile.test_a_declared_doxyfile_outside_the_repo_is_refused(Path tmp_path)

A declared path escaping the repository is refused, like every declared path.

tests/test_declared_doxyfile.py:63

Show on the map →

Called by none

Calls _resolve

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_a_declared_doxyfile_outside_the_repo_is_refused → _resolve → _resolve_doxyfile_and_root → derive_scope
REQ-DDB-GUARD-012inferredtest_a_declared_doxyfile_outside_the_repo_is_refused → _resolve → _resolve_doxyfile_and_root → derive_scope → _declared_index_scope → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node
REQ-DDB-INDEX-001inferredtest_a_declared_doxyfile_outside_the_repo_is_refused → _resolve → _resolve_doxyfile_and_root → discover_doxyfile
REQ-DDB-PIPE-014measuredtest_a_declared_doxyfile_outside_the_repo_is_refused → _resolve → _resolve_doxyfile_and_root → _declared_doxyfile → within_repo
REQ-DDB-WIKI-054inferredtest_a_declared_doxyfile_outside_the_repo_is_refused → _resolve → _resolve_doxyfile_and_root → derive_scope → _declared_index_scope → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all
Source · 8 lines
def test_a_declared_doxyfile_outside_the_repo_is_refused(tmp_path: Path) -> None:
    """@brief A declared path escaping the repository is refused, like every declared path."""
    outside = tmp_path.parent / "elsewhere.doxyfile"
    outside.write_text("INPUT = .\n", encoding="utf-8")
    with pytest.raises(DeclarationError, match="doxyfile"):
        _resolve(tmp_path, f"doxyfile: {outside}\n")

Activity · 4 steps
lines 65–65outside = tmp_path.parent / "elsewhere.doxyfile"lines 66–66outside.write_text("INPUT = .\n", encoding="utf-8")lines 67–67with pytest.raises(DeclarationError, match="doxyfile")lines 68–68_resolve(tmp_path, f"doxyfile: {outside}\n")

test_a_declared_doxyfile_that_does_not_exist_is_refused

None test_declared_doxyfile.test_a_declared_doxyfile_that_does_not_exist_is_refused(Path tmp_path)

A missing declared Doxyfile is refused, naming it.

tests/test_declared_doxyfile.py:53

Show on the map →

Called by none

Calls _resolve

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_a_declared_doxyfile_that_does_not_exist_is_refused → _resolve → _resolve_doxyfile_and_root → derive_scope
REQ-DDB-GUARD-012inferredtest_a_declared_doxyfile_that_does_not_exist_is_refused → _resolve → _resolve_doxyfile_and_root → derive_scope → _declared_index_scope → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node
REQ-DDB-INDEX-001inferredtest_a_declared_doxyfile_that_does_not_exist_is_refused → _resolve → _resolve_doxyfile_and_root → discover_doxyfile
REQ-DDB-PIPE-014measuredtest_a_declared_doxyfile_that_does_not_exist_is_refused → _resolve → _resolve_doxyfile_and_root → _declared_doxyfile → within_repo
REQ-DDB-WIKI-054inferredtest_a_declared_doxyfile_that_does_not_exist_is_refused → _resolve → _resolve_doxyfile_and_root → derive_scope → _declared_index_scope → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all
Source · 10 lines
def test_a_declared_doxyfile_that_does_not_exist_is_refused(tmp_path: Path) -> None:
    """A missing declared Doxyfile changes WHICH SOURCE is indexed, so it is refused at the
    declaration rather than falling through to synthesis — the tier-1 rule, in-tree.

    @brief A missing declared Doxyfile is refused, naming it.
    """
    with pytest.raises(DeclarationError, match="doxygen/missing.doxyfile"):
        _resolve(tmp_path, "doxyfile: doxygen/missing.doxyfile\n")

Activity · 2 steps
lines 59–59with pytest.raises(DeclarationError, match="doxygen/missing.doxyfile")lines 60–60_resolve(tmp_path, "doxyfile: doxygen/missing.doxyfile\n")

test_an_in_tree_doxyfile_declaration_is_the_doxyfile

None test_declared_doxyfile.test_an_in_tree_doxyfile_declaration_is_the_doxyfile(Path tmp_path)

The checked-in `doxyfile:` applies; tier 1 outranks it.

tests/test_declared_doxyfile.py:39

Show on the map →

Called by none

Calls _resolve

Checks

  • assert _resolve(tmp_path, "doxyfile: doxygen/project.doxyfile\n") == declared.resolve()
  • assert _resolve(tmp_path, "doxyfile: doxygen/project.doxyfile\n", str(flag)) == flag.resolve()

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_an_in_tree_doxyfile_declaration_is_the_doxyfile → _resolve → _resolve_doxyfile_and_root → derive_scope
REQ-DDB-GUARD-012inferredtest_an_in_tree_doxyfile_declaration_is_the_doxyfile → _resolve → _resolve_doxyfile_and_root → derive_scope → _declared_index_scope → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node
REQ-DDB-INDEX-001inferredtest_an_in_tree_doxyfile_declaration_is_the_doxyfile → _resolve → _resolve_doxyfile_and_root → discover_doxyfile
REQ-DDB-PIPE-014measuredtest_an_in_tree_doxyfile_declaration_is_the_doxyfile → _resolve → _resolve_doxyfile_and_root → _declared_doxyfile → within_repo
REQ-DDB-WIKI-054inferredtest_an_in_tree_doxyfile_declaration_is_the_doxyfile → _resolve → _resolve_doxyfile_and_root → derive_scope → _declared_index_scope → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all
Source · 14 lines
def test_an_in_tree_doxyfile_declaration_is_the_doxyfile(tmp_path: Path) -> None:
    """F3: the declared file is used, not discovery, and a tier-1 statement still wins.

    @brief The checked-in `doxyfile:` applies; tier 1 outranks it.
    """
    (tmp_path / "doxygen").mkdir()
    declared = tmp_path / "doxygen" / "project.doxyfile"
    declared.write_text("INPUT = src\n", encoding="utf-8")
    (tmp_path / "Doxyfile").write_text("INPUT = .\n", encoding="utf-8")
    assert _resolve(tmp_path, "doxyfile: doxygen/project.doxyfile\n") == declared.resolve()
    flag = tmp_path / "Doxyfile"
    assert _resolve(tmp_path, "doxyfile: doxygen/project.doxyfile\n", str(flag)) == flag.resolve()

Activity · 7 steps
lines 44–44(tmp_path / "doxygen").mkdir()lines 45–45declared = tmp_path / "doxygen" / "project.doxyfile"lines 46–46declared.write_text("INPUT = src\n", encoding="utf-8")lines 47–47(tmp_path / "Doxyfile").write_text("INPUT = .\n", encoding="utf-8")lines 48–48assert _resolve(tmp_path, "doxyfile: doxygen/project.doxyfile\n") == declared.resolve()lines 49–49flag = tmp_path / "Doxyfile"lines 50–50assert _resolve(tmp_path, "doxyfile: doxygen/project.doxyfile\n", str(flag)) == flag.resolve()

test_overviews_declaration_example_loads_and_means_what_it_says

None test_declared_doxyfile.test_overviews_declaration_example_loads_and_means_what_it_says(Path tmp_path)

OVERVIEW.md's `.clew.yaml` example loads through the real loader.

tests/test_declared_doxyfile.py:71

Checks

  • assert block, "OVERVIEW.md's declaration example block was not found"
  • assert decl["kconfig"] == {"root": "Kconfig"}
  • assert set((declared_event_tags(decl) or {}).values()) == {"producer", "consumer"}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_overviews_declaration_example_loads_and_means_what_it_says → load_declaration
REQ-DDB-GUARD-012measuredtest_overviews_declaration_example_loads_and_means_what_it_says → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_requirements → _validate_node
REQ-DDB-WIKI-054inferredtest_overviews_declaration_example_loads_and_means_what_it_says → load_declaration → load_declaration_located → _checked_sections → _checked_section → _checked_list_section → all
Source · 18 lines
def test_overviews_declaration_example_loads_and_means_what_it_says(tmp_path: Path) -> None:
    """F2: `kconfig: {path:}` (the key is `root`), `event_tags: {emits: produce}` (the roles are
    `producer` / `consumer`) and `doxyfile:` were documented and wrong. The block is loaded as
    written, so the reference cannot drift from the loader again.

    @brief OVERVIEW.md's `.clew.yaml` example loads through the real loader.
    """
    text = (REPO / "docs" / "OVERVIEW.md").read_text(encoding="utf-8")
    block = re.search(
        r"```yaml\n# a --declare document, or <repo>/\.clew\.yaml\n(.*?)```", text, re.S
    )
    assert block, "OVERVIEW.md's declaration example block was not found"
    (tmp_path / "doxygen").mkdir()
    (tmp_path / "doxygen" / "project.doxyfile").write_text("INPUT = .\n", encoding="utf-8")
    (tmp_path / ".clew.yaml").write_text(block.group(1), encoding="utf-8")
    decl = load_declaration(tmp_path)
    assert decl["kconfig"] == {"root": "Kconfig"}
    assert set((declared_event_tags(decl) or {}).values()) == {"producer", "consumer"}

1 more lines, not shown

Activity · 9 steps
lines 78–78text = (REPO / "docs" / "OVERVIEW.md").read_text(encoding="utf-8")lines 79–81block = re.search( r"```yaml\n# a --declare document, or <repo>/\.clew\.yaml\n(.*?)```", text, re.S )lines 82–82assert block, "OVERVIEW.md's declaration example block was not found"lines 83–83(tmp_path / "doxygen").mkdir()lines 84–84(tmp_path / "doxygen" / "project.doxyfile").write_text("INPUT = .\n", encoding="utf-8")lines 85–85(tmp_path / ".clew.yaml").write_text(block.group(1), encoding="utf-8")lines 86–86decl = load_declaration(tmp_path)lines 87–87assert decl["kconfig"] == {"root": "Kconfig"}lines 88–88assert set((declared_event_tags(decl) or {}).values()) == {"producer", "consumer"}