Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.179
0.5.181
38 changes: 38 additions & 0 deletions tests/test_version_parity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""Test to strictly enforce version parity across all carriers and package code."""

from __future__ import annotations

import re
from pathlib import Path

import code2llm


def test_package_version_is_valid_semver():
"""__version__ must be a valid semver string and not 'unknown'."""
assert code2llm.__version__ != "unknown"
assert re.match(r"^\d+\.\d+\.\d+", code2llm.__version__), f"Invalid version format: {code2llm.__version__}"


def test_version_carrier_parity():
"""VERSION file, pyproject.toml, and code2llm.__version__ must match strictly."""
root = Path(__file__).resolve().parent.parent
version_file = root / "VERSION"
assert version_file.is_file(), "VERSION file is missing"
expected_version = version_file.read_text(encoding="utf-8").strip()

# 1. Check code2llm.__version__
assert code2llm.__version__ == expected_version, (
f"code2llm.__version__ ({code2llm.__version__}) does not match VERSION ({expected_version})"
)

# 2. Check pyproject.toml
pyproject_file = root / "pyproject.toml"
assert pyproject_file.is_file(), "pyproject.toml is missing"
pyproject_text = pyproject_file.read_text(encoding="utf-8")
match = re.search(r'(?m)^version\s*=\s*["\']([^"\']+)["\']', pyproject_text)
assert match, "version not declared in pyproject.toml"
pyproject_version = match.group(1)
assert pyproject_version == expected_version, (
f"pyproject.toml version ({pyproject_version}) does not match VERSION ({expected_version})"
)
Loading