"""Meta-gate checks for the CI workflow and pre-commit hook configuration.""" from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[2] CI = ROOT / ".github" / "workflows" / "ci.yml" PRECOMMIT = ROOT / ".pre-commit-config.yaml" HEADLESS_COMMAND = 'pytest tests/unit tests/services -m "not slow"' def test_ci_declares_all_jobs() -> None: """The workflow exposes the lint/type/test split as separate jobs.""" text = CI.read_text(encoding="utf-8") for job in ("lint:", "type:", "test-headless:", "test-gui:", "test-integration:"): assert f"\n {job}\n" in text, f"missing CI job: {job}" def test_ci_runs_the_headless_command() -> None: """The headless job runs the unit + services, non-slow command verbatim.""" assert HEADLESS_COMMAND in CI.read_text(encoding="utf-8") def test_precommit_declares_expected_hooks() -> None: """The pre-commit config wires up the lint/format/type/hygiene hooks.""" text = PRECOMMIT.read_text(encoding="utf-8") for hook in ( "id: ruff", "id: ruff-format", "id: mypy", "id: trailing-whitespace", "id: end-of-file-fixer", "id: check-yaml", "id: check-added-large-files", "id: check-merge-conflict", ): assert hook in text, f"missing pre-commit hook: {hook}"