test_guard_parent_catalogue.py

tests/guard/test_guard_parent_catalogue.py

A parent catalogue is checked when its clone is present, else reported unchecked (#73 item 3).

test_a_catalogue_not_marked_parent_still_refuses

None test_guard_parent_catalogue.test_a_catalogue_not_marked_parent_still_refuses(Path tmp_path, monkeypatch)

The default is unchanged: a missing pinned catalogue is an error naming it.

tests/guard/test_guard_parent_catalogue.py:65

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_a_catalogue_not_marked_parent_still_refuses → load_external_requirements → read_catalog_at → git_text → git_argv
REQ-DDB-GUARD-014measured
REQ-DDB-GUARD-027measuredtest_a_catalogue_not_marked_parent_still_refuses → load_external_requirements
Source · 8 lines
def test_a_catalogue_not_marked_parent_still_refuses(tmp_path: Path, monkeypatch) -> None:  # noqa: ANN001
    """@brief The default is unchanged: a missing pinned catalogue is an error naming it."""
    monkeypatch.chdir(tmp_path)
    entry = {"name": "product", "repo": "../product", "rev": "abc123", "path": "requirements.yaml"}
    with pytest.raises(RequirementsError):
        load_external_requirements(_config(entry), [])

Activity · 4 steps
lines 67–67monkeypatch.chdir(tmp_path)lines 68–68entry = {"name": "product", "repo": "../product", "rev": "abc123", "path": "requirements.yaml"}lines 69–69with pytest.raises(RequirementsError)lines 70–70load_external_requirements(_config(entry), [])

test_an_absent_parent_is_reported_unchecked_not_refused

None test_guard_parent_catalogue.test_an_absent_parent_is_reported_unchecked_not_refused(Path tmp_path, monkeypatch, caplog)

No clone: no error; its name is recorded; an unresolvable link is a warning.

tests/guard/test_guard_parent_catalogue.py:44

Checks

  • assert load_external_requirements(_config(entry), unchecked) == {}
  • assert unchecked == ["product"]
  • assert check_satisfies(rows, {"REQ-LIB-001"}, "requirements.yaml", unchecked) == []
  • assert "REQ-PRD-001" in caplog.text and "unchecked" in caplog.text and "product" in caplog.text

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-CONFIG-001measuredtest_an_absent_parent_is_reported_unchecked_not_refused → load_external_requirements → read_catalog_at → git_text → git_argv
REQ-DDB-GUARD-027measuredtest_an_absent_parent_is_reported_unchecked_not_refused → load_external_requirements
REQ-DDB-SCHEMA-015measuredtest_an_absent_parent_is_reported_unchecked_not_refused → check_satisfies
Source · 21 lines
def test_an_absent_parent_is_reported_unchecked_not_refused(
    tmp_path: Path, monkeypatch, caplog
) -> None:  # noqa: ANN001
    """@brief No clone: no error; its name is recorded; an unresolvable link is a warning."""
    monkeypatch.chdir(tmp_path)
    unchecked: list[str] = []
    entry = {
        "name": "product",
        "repo": "../product",
        "rev": "abc123",
        "path": "requirements.yaml",
        "parent": True,
    }
    assert load_external_requirements(_config(entry), unchecked) == {}
    assert unchecked == ["product"]
    rows = {"REQ-LIB-001": {"satisfies": "REQ-PRD-001"}}
    with caplog.at_level(logging.WARNING):
        assert check_satisfies(rows, {"REQ-LIB-001"}, "requirements.yaml", unchecked) == []
    assert "REQ-PRD-001" in caplog.text and "unchecked" in caplog.text and "product" in caplog.text

Activity · 9 steps
lines 48–48monkeypatch.chdir(tmp_path)lines 49–49unchecked: list[str] = []lines 50–56entry = { "name": "product", "repo": "../product", "rev": "abc123", "path": "requirements.yaml", "parent": True, }lines 57–57assert load_external_requirements(_config(entry), unchecked) == {}lines 58–58assert unchecked == ["product"]lines 59–59rows = {"REQ-LIB-001": {"satisfies": "REQ-PRD-001"}}lines 60–60with caplog.at_level(logging.WARNING)lines 61–61assert check_satisfies(rows, {"REQ-LIB-001"}, "requirements.yaml", unchecked) == []lines 62–62assert "REQ-PRD-001" in caplog.text and "unchecked" in caplog.text and "product" in caplog.text