test: version-sync test reads pyproject.toml instead of hard-coding
CI / Tests (py3.10 / ubuntu-latest) (pull_request) Successful in 8s
CI / Tests (py3.12 / windows-latest) (pull_request) Successful in 19s
CI / Tests (py3.12 / ubuntu-latest) (pull_request) Successful in 8s
CI / Tests (py3.13 / ubuntu-latest) (pull_request) Successful in 8s
CI / Lint (ruff) (pull_request) Successful in 7s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cowork Supervisor
2026-07-12 13:32:23 -04:00
parent 0ef4586698
commit 8cf19d43c4
+8 -2
View File
@@ -3,9 +3,11 @@ proper test functions with tmp_path/monkeypatch fixtures)."""
import json import json
import os import os
import re
import sys import sys
import urllib.error import urllib.error
import urllib.request import urllib.request
from pathlib import Path
import pytest import pytest
@@ -1187,8 +1189,12 @@ def test_restart_claude_desktop_linux_refuses_without_touching_processes(monkeyp
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
def test_dunder_version_matches_pyproject(): def test_dunder_version_matches_pyproject():
# Guards against the version drifting out of sync between the two places # Guards against the version drifting out of sync between the two places
# a human might bump it. # a human might bump it. Reads pyproject.toml rather than hard-coding a
assert c.__version__ == "1.2.0" # version here (which would make this a third place to bump).
text = (Path(__file__).parent.parent / "pyproject.toml").read_text(encoding="utf-8")
m = re.search(r'^version\s*=\s*"([^"]+)"', text, re.MULTILINE)
assert m, "no [project] version found in pyproject.toml"
assert c.__version__ == m.group(1)
def test_parse_version_basic(): def test_parse_version_basic():