Skip to content

Commit 08afcd4

Browse files
NMitchemclaude
andcommitted
fix: version test compat with Python 3.10 (no tomllib)
Use regex to parse version from pyproject.toml instead of tomllib which is only available in Python 3.11+. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent be23555 commit 08afcd4

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tests/test_version.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
def test_version_matches_pyproject():
22
"""Version in __init__.py must match pyproject.toml."""
3-
import tomllib
3+
import re
44
from pathlib import Path
55
from skillscan import __version__
66

77
pyproject = Path(__file__).parent.parent / "pyproject.toml"
8-
with open(pyproject, "rb") as f:
9-
meta = tomllib.load(f)
10-
assert __version__ == meta["project"]["version"]
8+
text = pyproject.read_text()
9+
match = re.search(r'^version\s*=\s*"([^"]+)"', text, re.MULTILINE)
10+
assert match, "Could not find version in pyproject.toml"
11+
assert __version__ == match.group(1)
1112

1213

1314
def test_sarif_fallback_version():

0 commit comments

Comments
 (0)