Skip to content

Commit 8aeea09

Browse files
jdrumgooleclaude
andcommitted
Add test that __version__ matches pyproject.toml's version
`solisdash.__version__` in `src/solisdash/__init__.py` and the `[project].version` field in `pyproject.toml` are two hand-edited sources of truth that have to stay in sync for `uv build` and the installed package's `__version__` to agree. This session twice hit the failure mode where a worktree's `pyproject.toml` got bumped but `__init__.py` was missed (or vice versa). The new test reads `pyproject.toml` and asserts equality — fails loudly the next time it happens. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ca73b6e commit 8aeea09

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "solisdash"
3-
version = "0.2.3"
3+
version = "0.2.4"
44
description = "Self-hosted dashboard for the SolisCloud platform"
55
readme = "README.md"
66
requires-python = ">=3.12"

‎src/solisdash/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.2.3"
1+
__version__ = "0.2.4"

‎tests/test_smoke.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from __future__ import annotations
22

3+
import tomllib
4+
from pathlib import Path
5+
36
from fastapi.testclient import TestClient
47

58
import solisdash
@@ -9,6 +12,15 @@ def test_package_version() -> None:
912
assert solisdash.__version__
1013

1114

15+
def test_version_matches_pyproject() -> None:
16+
"""`__version__` and `pyproject.toml [project].version` are two hand-kept
17+
sources of truth — drift here means a release bumps one but not the other.
18+
"""
19+
pyproject = Path(__file__).parent.parent / "pyproject.toml"
20+
data = tomllib.loads(pyproject.read_text())
21+
assert solisdash.__version__ == data["project"]["version"]
22+
23+
1224
def test_health(client: TestClient) -> None:
1325
response = client.get("/health")
1426
assert response.status_code == 200

‎uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)