Skip to content
Merged
Changes from 1 commit
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
27 changes: 27 additions & 0 deletions tests/python/unit/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""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)
Comment thread
ppinchuk marked this conversation as resolved.
Outdated
assert v != "9999"
Loading