-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathtest_versions.py
More file actions
36 lines (26 loc) · 1023 Bytes
/
test_versions.py
File metadata and controls
36 lines (26 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Tests for functions in _versions submodule.
"""
from importlib.metadata import version
from pathlib import Path
import toml
import scyjava
def _expected_version():
"""
Get the project version from pyproject.toml.
"""
pyproject = toml.load(Path(__file__).parents[1] / "pyproject.toml")
return pyproject["project"]["version"]
def test_version():
sjver = _expected_version()
# First, ensure that the version is correct.
assert sjver == scyjava.__version__
# Then, ensure that we get the correct version via get_version.
assert sjver == scyjava.get_version("scyjava")
assert sjver == scyjava.get_version(scyjava)
assert sjver == scyjava.get_version("scyjava.config")
assert sjver == scyjava.get_version(scyjava.config)
assert sjver == scyjava.get_version(scyjava.config.mode)
assert sjver == scyjava.get_version(scyjava.config.Mode)
# And that we get the correct version of other things, too.
assert version("toml") == scyjava.get_version(toml)