Skip to content

test+docs: strict markers, test ruff ignore, docstring coverage gate - #54

Merged
mrebbert merged 1 commit into
mainfrom
test/xs-sweep
Oct 16, 2026
Merged

mrebbert merged 1 commit into
mainfrom
test/xs-sweep

Conversation

@mrebbert

Copy link
Copy Markdown
Owner

Summary

Erste Welle Adoptions aus der HA-Testing-Analyse. Drei XS-Hebel ohne neue Dependencies im Hot-Path:

1. pytest -ra --strict-markers

  • `-ra` druckt am Ende des Laufs eine Kurzzusammenfassung aller non-pass-Outcomes.
  • `--strict-markers` lehnt getippte `@pytest.mark.*`-Dekoratoren ab, statt sie still zu übergehen.

2. ruff per-file-ignore für Tests

`"tests/*" = ["B011"]` erlaubt `assert False` als explizite Test-Intention (bekannter HA-Pattern), ohne B011 projekt-weit zu entschärfen.

3. Interrogate-Docstring-Coverage-Gate

  • `interrogate>=1.7` als dev-dep, Config in `pyproject.toml`.
  • Fail-under: 85 %. Aktueller Stand: 96.4 %.
  • Scope-Excludes: `tests`, `scripts`, `cli.py` (argparse-Glue), `sync.py` (mechanisches Async-Facade).
  • `from_dict`-Classmethods via `ignore-regex` ausgeklammert, weil ihr Name und ihre Signatur bereits reden.
  • Neuer CI-Job `interrogate` in `lint.yml`.

Test plan

  • `uv run pytest --cov --cov-report=term` → 529 passed, 34 skipped, 96.14 %
  • `uv run interrogate onekommafive --config pyproject.toml` → PASSED (96.4 %)
  • `uv run mypy --strict onekommafive` → sauber
  • `uv run pre-commit run --all-files` → sauber

🤖 Generated with Claude Code

https://claude.ai/code/session_01RgkYaQACLxezeceA1hrXQs

Three XS adoptions from the sibling 1komma5-ha repo's test stack:

1. pytest: addopts += "-ra --strict-markers". -ra prints a short summary
   of every non-pass outcome at the end of the run; --strict-markers
   rejects typos in @pytest.mark.* decorators instead of silently
   ignoring them.
2. ruff per-file-ignores: "tests/*" = ["B011"] so `assert False` is
   accepted as explicit test intent (ha pattern).
3. interrogate>=1.7 as a dev-dep with a docstring-coverage gate at
   fail-under=85 %. Scope excludes tests, scripts, cli.py (argparse
   glue) and sync.py (mechanical facade); from_dict classmethods are
   ignored via ignore-regex. Current baseline: 96.4 %. CI runs the
   gate as a new `interrogate` job in lint.yml.

The CONTRIBUTING.md trailing-whitespace drop is a side effect of
pre-commit's trim-trailing-whitespace hook.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RgkYaQACLxezeceA1hrXQs
@mrebbert
mrebbert merged commit eb7883a into main Oct 16, 2026
9 checks passed
@mrebbert
mrebbert deleted the test/xs-sweep branch October 16, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant