test: meta gates for architecture, CI, docs and packaging
This commit is contained in:
parent
f1d58273b7
commit
ff09e38b7c
5 changed files with 388 additions and 0 deletions
29
tests/unit/test_meta_gates.py
Normal file
29
tests/unit/test_meta_gates.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""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")
|
||||
Loading…
Reference in a new issue