"""Meta-gates tying the test markers to the CI commands that consume them.""" from __future__ import annotations from pathlib import Path try: import tomllib except ModuleNotFoundError: # Python < 3.11 import tomli as tomllib ROOT = Path(__file__).resolve().parents[2] PYPROJECT = ROOT / "pyproject.toml" CI = ROOT / ".github" / "workflows" / "ci.yml" HEADLESS_COMMAND = 'pytest tests/unit tests/services -m "not slow"' def test_slow_marker_is_declared() -> None: """``[tool.pytest.ini_options]`` registers the ``slow`` marker.""" with PYPROJECT.open("rb") as handle: config = tomllib.load(handle) markers = config["tool"]["pytest"]["ini_options"]["markers"] assert any(marker.startswith("slow:") for marker in markers), markers def test_ci_runs_the_headless_command() -> None: """The headless CI command matches the marker the suite expects.""" assert HEADLESS_COMMAND in CI.read_text(encoding="utf-8")