Repository navigation
test: snapshot tests for CLI output via syrupy - #55
Merged
Merged
Conversation
Adds syrupy as a dev-dep and tests/test_cli_snapshots.py: one snapshot per user-facing subcommand (info, live, weather, system-info with and without §14a enrolment, heartbeat-prices, ems). Each handler runs against the stable mock payloads already in tests/fixtures.py; the captured stdout is compared to a stored *.ambr snapshot. Catches format drift immediately — a new column, a renamed row, a dropped unit suffix fails CI instead of landing silently. Snapshots are updated with `uv run pytest tests/test_cli_snapshots.py --snapshot-update` and reviewed as part of the PR. Co-Authored-By: Claude Opus 4.7 <[email protected]> Claude-Session: https://claude.ai/code/session_01RgkYaQACLxezeceA1hrXQs
mrebbert
force-pushed
the
test/cli-snapshots
branch
from
October 16, 2026 06:16
74950d5 to
e0ebac4
Compare
3 of 4 tasks
mrebbert
added a commit
that referenced
this pull request
Oct 16, 2026
uv sync without flags now installs the full test toolbelt (aioresponses, pytest, syrupy, hypothesis, mypy, ruff ...). Previously the dev set lived only in [project.optional-dependencies] dev and required --all-extras — fresh clones silently missed the `snapshot` fixture from syrupy and test_cli_snapshots.py would error. - Add [dependency-groups] dev mirroring the extras list; uv auto- installs it so contributors need not remember --all-extras. - Keep [project.optional-dependencies] dev for the pip CI matrix (pip install ".[dev]"), tightened the syrupy floor to >=6.0 to match the version CI has been running since PR #55. - README.md and docs/development.md drop --all-extras from the setup snippet; docs call out the test-mutation opt-in flag. - uv.lock regenerated. CI (nightly.yml, tests.yml, mutation.yml) keeps --all-extras so test-mutation gets picked up where it is needed. Claude-Session: https://claude.ai/code/session_01RgkYaQACLxezeceA1hrXQs Co-authored-by: Claude Opus 4.7 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Zweite Welle der HA-Adoptions: Snapshot-Tests für den CLI-Output. Zieht die CLI-Formatierungs-Oberfläche aus der Augen-Diff-Regime in CI.
Was neu ist
Was das aufdeckt
Jede Format-Drift fliegt sofort auf:
Aktualisieren nach bewusster Format-Änderung:
```
uv run pytest tests/test_cli_snapshots.py --snapshot-update
```
Der Snapshot-Diff landet mit im PR und wird explizit geprüft.
Test plan
🤖 Generated with Claude Code
https://claude.ai/code/session_01RgkYaQACLxezeceA1hrXQs