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
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_a_declared_doxyfile_outside_the_repo_is_refused → _resolve → _resolve_doxyfile_and_root → derive_scope |
| REQ-DDB-GUARD-012 | inferred | test_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-001 | inferred | test_a_declared_doxyfile_outside_the_repo_is_refused → _resolve → _resolve_doxyfile_and_root → discover_doxyfile |
| REQ-DDB-PIPE-014 | measured | test_a_declared_doxyfile_outside_the_repo_is_refused → _resolve → _resolve_doxyfile_and_root → _declared_doxyfile → within_repo |
| REQ-DDB-WIKI-054 | inferred | test_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
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
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_a_declared_doxyfile_that_does_not_exist_is_refused → _resolve → _resolve_doxyfile_and_root → derive_scope |
| REQ-DDB-GUARD-012 | inferred | test_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-001 | inferred | test_a_declared_doxyfile_that_does_not_exist_is_refused → _resolve → _resolve_doxyfile_and_root → discover_doxyfile |
| REQ-DDB-PIPE-014 | measured | test_a_declared_doxyfile_that_does_not_exist_is_refused → _resolve → _resolve_doxyfile_and_root → _declared_doxyfile → within_repo |
| REQ-DDB-WIKI-054 | inferred | test_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
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
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
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_an_in_tree_doxyfile_declaration_is_the_doxyfile → _resolve → _resolve_doxyfile_and_root → derive_scope |
| REQ-DDB-GUARD-012 | inferred | test_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-001 | inferred | test_an_in_tree_doxyfile_declaration_is_the_doxyfile → _resolve → _resolve_doxyfile_and_root → discover_doxyfile |
| REQ-DDB-PIPE-014 | measured | test_an_in_tree_doxyfile_declaration_is_the_doxyfile → _resolve → _resolve_doxyfile_and_root → _declared_doxyfile → within_repo |
| REQ-DDB-WIKI-054 | inferred | test_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
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
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_overviews_declaration_example_loads_and_means_what_it_says → load_declaration |
| REQ-DDB-GUARD-012 | measured | test_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-054 | inferred | test_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