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
3 changes: 3 additions & 0 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions tests/python/unit/test_version.py
Original file line number Diff line number Diff line change
@@ -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"