test_guard_exclude_counted.py¶
tests/guard/test_guard_exclude_counted.py
A file `guard.validate.exclude` leaves out is counted in the gate's skip report (PG6; 2.0.0).
test_an_excluded_file_is_counted_as_not_checked
None test_guard_exclude_counted.test_an_excluded_file_is_counted_as_not_checked(Path tmp_path, pytest.MonkeyPatch monkeypatch, pytest.CaptureFixture capsys)
One file excluded by a declared glob: the stderr report counts it, naming the reason.
tests/guard/test_guard_exclude_counted.py:25
Checks
assert main(["validate", "--no-git", "gen/a.c", "b.c"]) == 0assert "1 file(s) not checked" in err and "validate.exclude" in err, err
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-009 | measured | |
| REQ-DDB-GUARD-001 | measured | |
| REQ-DDB-GUARD-003 | measured | |
| REQ-DDB-GUARD-004 | measured | |
| REQ-DDB-GUARD-005 | measured | |
| REQ-DDB-GUARD-006 | measured | |
| REQ-DDB-GUARD-011 | measured | |
| REQ-DDB-GUARD-012 | measured | |
| REQ-DDB-GUARD-013 | measured | |
| REQ-DDB-GUARD-014 | measured | |
| REQ-DDB-GUARD-018 | measured | |
| REQ-DDB-GUARD-020 | measured | |
| REQ-DDB-GUARD-024 | measured | |
| REQ-DDB-GUARD-026 | measured | |
| REQ-DDB-GUARD-027 | measured | |
| REQ-DDB-PIPE-011 | measured | |
| REQ-DDB-SCHEMA-015 | measured |
Source · 12 lines
def test_an_excluded_file_is_counted_as_not_checked(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture
) -> None:
"""@brief One file excluded by a declared glob: the stderr report counts it, naming the reason."""
(tmp_path / "gen").mkdir()
(tmp_path / "gen/a.c").write_text(_BLOCK.format(name="a.c"))
(tmp_path / "b.c").write_text(_BLOCK.format(name="b.c"))
(tmp_path / ".clew.yaml").write_text('guard:\n validate:\n exclude: ["gen/**"]\n')
monkeypatch.chdir(tmp_path)
assert main(["validate", "--no-git", "gen/a.c", "b.c"]) == 0
err = capsys.readouterr().err
assert "1 file(s) not checked" in err and "validate.exclude" in err, err1 more lines, not shown