diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml index 3b3af0c0d..9045cab95 100644 --- a/.github/workflows/ci-python.yml +++ b/.github/workflows/ci-python.yml @@ -47,6 +47,7 @@ jobs: - name: Checkout Repo uses: actions/checkout@v5 with: + fetch-depth: 0 fetch-tags: true - uses: prefix-dev/setup-pixi@v0.9.3 @@ -75,6 +76,7 @@ jobs: - name: Checkout Repo uses: actions/checkout@v5 with: + fetch-depth: 0 fetch-tags: true - uses: prefix-dev/setup-pixi@v0.9.3 @@ -103,6 +105,7 @@ jobs: - name: Checkout Repo uses: actions/checkout@v5 with: + fetch-depth: 0 fetch-tags: true - uses: prefix-dev/setup-pixi@v0.9.3 diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 938bb72d6..946c8e62d 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -25,6 +25,7 @@ jobs: steps: - uses: actions/checkout@v5 with: + fetch-depth: 0 fetch-tags: true - uses: prefix-dev/setup-pixi@v0.9.3 diff --git a/tests/python/unit/test_version.py b/tests/python/unit/test_version.py new file mode 100644 index 000000000..5d0f57d05 --- /dev/null +++ b/tests/python/unit/test_version.py @@ -0,0 +1,30 @@ +"""Tests for version access + +Ensures that `compass.__version__` is exposed and semantically shaped. +We allow dev/local forms produced by setuptools_scm +(e.g., 0.11.3.dev8+gHASH). +""" + +import re + +import compass + + +SEMVER_DEV_PATTERN = re.compile(r"^\d+\.\d+\.\d+(?:\.dev\d+\+g[0-9a-f]+)?$") + + +def test_version_string_present(): + """`__version__` attribute exists, is a non-empty string""" + assert hasattr(compass, "__version__") + assert isinstance(compass.__version__, str) + assert compass.__version__ # non-empty + + +def test_version_semantic_shape(): + """Version matches dev semver pattern""" + v = compass.__version__ + assert SEMVER_DEV_PATTERN.match(v) is not None, ( + f"Version {v} does not match expected pattern" + ) + assert v != "9999", "Version set to placeholder" + assert not v.startswith("10000"), "Version set to placeholder"