test_guard_doxyfile.py

tests/guard/test_guard_doxyfile.py

Tests for Doxyfile fragment generation.

test_custom_configured_tags_are_included

test_guard_doxyfile.TestToolTagsFor.test_custom_configured_tags_are_included(self)

tests/guard/test_guard_doxyfile.py:25

Checks

  • assert "mytag" in tool_tags_for(config)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_custom_configured_tags_are_included → tool_tags_for
Source · 4 lines
    def test_custom_configured_tags_are_included(self):
        config = deep_merge(CONFIG_DEFAULTS, {"validate": {"tags": {"mytag": {"pattern": ".*"}}}})
        assert "mytag" in tool_tags_for(config)
Activity · 2 steps
lines 26–26config = deep_merge(CONFIG_DEFAULTS, {"validate": {"tags": {"mytag": {"pattern": ".*"}}}})lines 27–27assert "mytag" in tool_tags_for(config)

test_declares_an_alias_for_every_tool_tag

test_guard_doxyfile.TestBuildFragment.test_declares_an_alias_for_every_tool_tag(self)

tests/guard/test_guard_doxyfile.py:45

Checks

  • assert f'ALIASES += "{tag}' in fragment, tag

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_declares_an_alias_for_every_tool_tag → build_fragment
Source · 5 lines
    def test_declares_an_alias_for_every_tool_tag(self):
        fragment = build_fragment(CONFIG_DEFAULTS)
        for tag in tool_tags_for(CONFIG_DEFAULTS):
            assert f'ALIASES += "{tag}' in fragment, tag
Activity · 3 steps
lines 46–46fragment = build_fragment(CONFIG_DEFAULTS)lines 47–47◇ for tag in tool_tags_for(CONFIG_DEFAULTS)lines 48–48assert f'ALIASES += "{tag}' in fragment, tag

test_default_version_tag_is_not_aliased

test_guard_doxyfile.TestToolTagsFor.test_default_version_tag_is_not_aliased(self)

tests/guard/test_guard_doxyfile.py:40

Checks

  • assert "version" not in tool_tags_for(CONFIG_DEFAULTS)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_default_version_tag_is_not_aliased → tool_tags_for
Source · 4 lines
    def test_default_version_tag_is_not_aliased(self):
        assert "version" not in tool_tags_for(CONFIG_DEFAULTS)

Activity · 1 steps
lines 41–41assert "version" not in tool_tags_for(CONFIG_DEFAULTS)

test_enables_validity_checking

test_guard_doxyfile.TestBuildFragment.test_enables_validity_checking(self)

tests/guard/test_guard_doxyfile.py:61

Checks

  • assert "WARN_IF_DOC_ERROR = YES" in build_fragment(CONFIG_DEFAULTS)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_enables_validity_checking → build_fragment
Source · 3 lines
    def test_enables_validity_checking(self):
        assert "WARN_IF_DOC_ERROR = YES" in build_fragment(CONFIG_DEFAULTS)
Activity · 1 steps
lines 62–62assert "WARN_IF_DOC_ERROR = YES" in build_fragment(CONFIG_DEFAULTS)

test_every_tool_owned_tag_is_included

test_guard_doxyfile.TestToolTagsFor.test_every_tool_owned_tag_is_included(self)

tests/guard/test_guard_doxyfile.py:16

Checks

  • assert tags >= TOOL_OWNED_TAGS

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_every_tool_owned_tag_is_included → tool_tags_for
Source · 4 lines
    def test_every_tool_owned_tag_is_included(self):
        tags = set(tool_tags_for(CONFIG_DEFAULTS))
        assert tags >= TOOL_OWNED_TAGS
Activity · 2 steps
lines 17–17tags = set(tool_tags_for(CONFIG_DEFAULTS))lines 18–18assert tags >= TOOL_OWNED_TAGS

test_exemption_markers_map_to_nothing

test_guard_doxyfile.TestBuildFragment.test_exemption_markers_map_to_nothing(self)

Markers carry no payload, so they should render as empty rather than a section.

tests/guard/test_guard_doxyfile.py:50

Checks

  • assert f'ALIASES += "{tag}="' in fragment, tag

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_exemption_markers_map_to_nothing → build_fragment
Source · 6 lines
    def test_exemption_markers_map_to_nothing(self):
        """Markers carry no payload, so they should render as empty rather than a section."""
        fragment = build_fragment(CONFIG_DEFAULTS)
        for tag in sorted(EXEMPTION_TAGS):
            assert f'ALIASES += "{tag}="' in fragment, tag
Activity · 3 steps
lines 52–52fragment = build_fragment(CONFIG_DEFAULTS)lines 53–53◇ for tag in sorted(EXEMPTION_TAGS)lines 54–54assert f'ALIASES += "{tag}="' in fragment, tag

test_extra_tags_are_included

test_guard_doxyfile.TestToolTagsFor.test_extra_tags_are_included(self)

tests/guard/test_guard_doxyfile.py:29

Checks

  • assert "sends" in tags
  • assert "receives" in tags, "the leading at-sign should be stripped"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_extra_tags_are_included → tool_tags_for
Source · 6 lines
    def test_extra_tags_are_included(self):
        config = deep_merge(CONFIG_DEFAULTS, {"validate": {"extra_tags": ["sends", "@receives"]}})
        tags = tool_tags_for(config)
        assert "sends" in tags
        assert "receives" in tags, "the leading at-sign should be stripped"
Activity · 4 steps
lines 30–30config = deep_merge(CONFIG_DEFAULTS, {"validate": {"extra_tags": ["sends", "@receives"]}})lines 31–31tags = tool_tags_for(config)lines 32–32assert "sends" in tagslines 33–33assert "receives" in tags, "the leading at-sign should be stripped"

test_internal_docs_enabled_so_markers_hide_nothing

test_guard_doxyfile.TestBuildFragment.test_internal_docs_enabled_so_markers_hide_nothing(self)

\\internal-style suppression is exactly the bug the exemption rename avoided.

tests/guard/test_guard_doxyfile.py:75

Checks

  • assert "INTERNAL_DOCS = YES" in build_fragment(CONFIG_DEFAULTS)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_internal_docs_enabled_so_markers_hide_nothing → build_fragment
Source · 4 lines
    def test_internal_docs_enabled_so_markers_hide_nothing(self):
        """\\internal-style suppression is exactly the bug the exemption rename avoided."""
        assert "INTERNAL_DOCS = YES" in build_fragment(CONFIG_DEFAULTS)
Activity · 1 steps
lines 77–77assert "INTERNAL_DOCS = YES" in build_fragment(CONFIG_DEFAULTS)

test_is_include_ready

test_guard_doxyfile.TestBuildFragment.test_is_include_ready(self)

tests/guard/test_guard_doxyfile.py:79

Checks

  • assert fragment.endswith("\n")
  • assert "@INCLUDE" in fragment, "should document how to include it"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_is_include_ready → build_fragment
Source · 5 lines
    def test_is_include_ready(self):
        fragment = build_fragment(CONFIG_DEFAULTS)
        assert fragment.endswith("\n")
        assert "@INCLUDE" in fragment, "should document how to include it"
Activity · 3 steps
lines 80–80fragment = build_fragment(CONFIG_DEFAULTS)lines 81–81assert fragment.endswith("\n")lines 82–82assert "@INCLUDE" in fragment, "should document how to include it"

test_needs_no_doxygen_installed

test_guard_doxyfile.TestBuildFragment.test_needs_no_doxygen_installed(self)

Pure text generation — doxygen is never a runtime dependency of the gate.

tests/guard/test_guard_doxyfile.py:84

Checks

  • assert isinstance(build_fragment(CONFIG_DEFAULTS), str)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_needs_no_doxygen_installed → build_fragment
Source · 3 lines
    def test_needs_no_doxygen_installed(self):
        """Pure text generation — doxygen is never a runtime dependency of the gate."""
        assert isinstance(build_fragment(CONFIG_DEFAULTS), str)

1 more lines, not shown

Activity · 1 steps
lines 86–86assert isinstance(build_fragment(CONFIG_DEFAULTS), str)

test_non_default_version_tag_is_included

test_guard_doxyfile.TestToolTagsFor.test_non_default_version_tag_is_included(self)

Pointing the revision counter at a custom tag means doxygen needs that too.

tests/guard/test_guard_doxyfile.py:35

Checks

  • assert "revision" in tool_tags_for(config)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_non_default_version_tag_is_included → tool_tags_for
Source · 5 lines
    def test_non_default_version_tag_is_included(self):
        """Pointing the revision counter at a custom tag means doxygen needs that too."""
        config = deep_merge(CONFIG_DEFAULTS, {"validate": {"version": {"tag": "@revision"}}})
        assert "revision" in tool_tags_for(config)
Activity · 2 steps
lines 37–37config = deep_merge(CONFIG_DEFAULTS, {"validate": {"version": {"tag": "@revision"}}})lines 38–38assert "revision" in tool_tags_for(config)

test_policy_warnings_are_opt_in_not_default

test_guard_doxyfile.TestBuildFragment.test_policy_warnings_are_opt_in_not_default(self)

Measured: enabling these produces 399 warnings against this repo, none of which are defects by doxygen-guard's standard — 309 are WARN_NO_PARAMDOC demanding

tests/guard/test_guard_doxyfile.py:64

Checks

  • assert f"# {key} = YES" in fragment, f"{key} should be a commented opt-in"
  • assert f"\n{key} = YES" not in fragment, f"{key} must not be active"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_policy_warnings_are_opt_in_not_default → build_fragment
Source · 11 lines
    def test_policy_warnings_are_opt_in_not_default(self):
        """Measured: enabling these produces 399 warnings against this repo, none of
        which are defects by doxygen-guard's standard — 309 are WARN_NO_PARAMDOC
        demanding @param for every parameter. Turning them on by default would impose
        doxygen's policy on adopters, inverting the division of authority.
        """
        fragment = build_fragment(CONFIG_DEFAULTS)
        for key in ("WARN_IF_UNDOCUMENTED", "WARN_NO_PARAMDOC"):
            assert f"# {key} = YES" in fragment, f"{key} should be a commented opt-in"
            assert f"\n{key} = YES" not in fragment, f"{key} must not be active"
Activity · 4 steps
lines 70–70fragment = build_fragment(CONFIG_DEFAULTS)lines 71–71◇ for key in ("WARN_IF_UNDOCUMENTED", "WARN_NO_PARAMDOC")lines 72–72assert f"# {key} = YES" in fragment, f"{key} should be a commented opt-in"lines 73–73assert f"\n{key} = YES" not in fragment, f"{key} must not be active"

test_real_doxygen_commands_are_never_aliased

test_guard_doxyfile.TestToolTagsFor.test_real_doxygen_commands_are_never_aliased(self)

Aliasing a standard command would override doxygen's own definition.

tests/guard/test_guard_doxyfile.py:20

Checks

  • assert tags.isdisjoint({"brief", "version", "return", "returns", "file", "param"})

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_real_doxygen_commands_are_never_aliased → tool_tags_for
Source · 5 lines
    def test_real_doxygen_commands_are_never_aliased(self):
        """Aliasing a standard command would override doxygen's own definition."""
        tags = set(tool_tags_for(CONFIG_DEFAULTS))
        assert tags.isdisjoint({"brief", "version", "return", "returns", "file", "param"})
Activity · 2 steps
lines 22–22tags = set(tool_tags_for(CONFIG_DEFAULTS))lines 23–23assert tags.isdisjoint({"brief", "version", "return", "returns", "file", "param"})

test_req_becomes_a_cross_referenced_section

test_guard_doxyfile.TestBuildFragment.test_req_becomes_a_cross_referenced_section(self)

tests/guard/test_guard_doxyfile.py:56

Checks

  • assert "xrefitem req" in fragment
  • assert "Requirement" in fragment

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-017measuredtest_req_becomes_a_cross_referenced_section → build_fragment
Source · 5 lines
    def test_req_becomes_a_cross_referenced_section(self):
        fragment = build_fragment(CONFIG_DEFAULTS)
        assert "xrefitem req" in fragment
        assert "Requirement" in fragment
Activity · 3 steps
lines 57–57fragment = build_fragment(CONFIG_DEFAULTS)lines 58–58assert "xrefitem req" in fragmentlines 59–59assert "Requirement" in fragment