Skip to content

Commit 6ea6da9

Browse files
author
CID Agent
committed
Read expected version from Cargo.toml in smoke test
Prevents test breakage on version bumps by deriving the expected version dynamically instead of hardcoding it.
1 parent 3729d96 commit 6ea6da9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_smoke.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import io
44
import json
5+
import re
6+
from pathlib import Path
57

68
import iscc_lib
79
from iscc_lib import (
@@ -19,9 +21,13 @@
1921

2022
def test_version_exists_and_correct():
2123
"""Verify __version__ is a string matching the workspace version."""
24+
cargo_toml = Path(__file__).resolve().parent.parent / "Cargo.toml"
25+
match = re.search(r'^version\s*=\s*"(.+?)"', cargo_toml.read_text(), re.MULTILINE)
26+
assert match is not None, "version not found in Cargo.toml"
27+
expected = match.group(1)
2228
assert hasattr(iscc_lib, "__version__")
2329
assert isinstance(iscc_lib.__version__, str)
24-
assert iscc_lib.__version__ == "0.0.1"
30+
assert iscc_lib.__version__ == expected
2531

2632

2733
def test_version_in_all():

0 commit comments

Comments
 (0)