Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
29 changes: 29 additions & 0 deletions tests/python/unit/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""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]+)?$")
Comment thread
ppinchuk marked this conversation as resolved.


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"
Comment thread
ppinchuk marked this conversation as resolved.