Skip to content

Commit 7848e6c

Browse files
committed
[DEVOPS-637] add test on package version consistency
1 parent 7120f60 commit 7848e6c

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

tests/version_test.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
2+
# Copyright (c) 2024-2025 Mira Geoscience Ltd. '
3+
# '
4+
# This file is part of mirageoscience.pre-commit-hooks package. '
5+
# '
6+
# mirageoscience.pre-commit-hooks is distributed under the terms and conditions '
7+
# of the MIT License (see LICENSE file at the root of this source code package). '
8+
# '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
9+
10+
from __future__ import annotations
11+
12+
from pathlib import Path
13+
14+
import tomli as toml
15+
from packaging.version import Version
16+
17+
from mirageoscience import hooks as mira_hooks
18+
19+
20+
def get_pyproject_version():
21+
path = Path(__file__).resolve().parents[1] / "pyproject.toml"
22+
23+
with open(str(path), encoding="utf-8") as file:
24+
pyproject = toml.loads(file.read())
25+
26+
return pyproject["tool"]["poetry"]["version"]
27+
28+
29+
def test_version_is_consistent():
30+
assert mira_hooks.__version__ == get_pyproject_version()
31+
32+
33+
def test_version_is_pep440():
34+
version = Version(mira_hooks.__version__)
35+
assert version is not None

0 commit comments

Comments
 (0)