File size: 913 Bytes
0be1905
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
try:
    import tomllib  # Python 3.11+
except ImportError:
    import tomli as tomllib  # Python < 3.11

from pathlib import Path

from katrain.core.constants import VERSION


def test_version_consistency():
    """Test that the version in constants.py matches the version in pyproject.toml"""
    # Get the project root directory (parent of tests directory)
    project_root = Path(__file__).parent.parent
    pyproject_path = project_root / "pyproject.toml"
    
    # Read the version from pyproject.toml
    with open(pyproject_path, "rb") as f:
        pyproject_data = tomllib.load(f)
    
    pyproject_version = pyproject_data["project"]["version"]
    
    # Compare versions
    assert VERSION == pyproject_version, (
        f"Version mismatch: constants.py has '{VERSION}' but "
        f"pyproject.toml has '{pyproject_version}'. "
        "Please update both files to have the same version."
    )