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
1 change: 1 addition & 0 deletions arch/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ subdir('univariate')

subdirs_list = [
'__future__',
'_build',
'bootstrap',
'compat',
'covariance',
Expand Down
36 changes: 36 additions & 0 deletions arch/tests/test_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import tempfile

import pytest

from arch import __version__, version_tuple

try:
from arch._build.git_version import get_version, write_version_file

HAS_SETUPTOOLS_SCM = True
except ImportError:
HAS_SETUPTOOLS_SCM = False


@pytest.mark.skipif(not HAS_SETUPTOOLS_SCM, reason="setuptools_scm is not installed")
def test_get_version():
try:
version, version_fields = get_version()

assert isinstance(version, str)
assert isinstance(version_fields, tuple)
assert all(isinstance(v, (int, str)) for v in version_fields)
except LookupError:
pytest.skip("No git repository found")


@pytest.mark.skipif(not HAS_SETUPTOOLS_SCM, reason="setuptools_scm is not installed")
def test_write_version_file():
with tempfile.NamedTemporaryFile(delete=False) as tmpfile:

write_version_file(tmpfile.name, __version__, version_tuple)
with open(tmpfile.name, "r") as f:
content = f.read()

assert f"__version__ = version = '{__version__}'" in content
assert f"__version_tuple__ = version_tuple = {version_tuple}" in content