Skip to content

Commit 8bdead8

Browse files
committed
test: __version__ matches package's actual version
1 parent 526ca4a commit 8bdead8

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

poetry.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ varname = ["varname"]
2727
pytest = "^6.2.1"
2828
mypy = "^0.971"
2929
black = "^20.8b1"
30+
toml = "*"
3031

3132
[build-system]
3233
requires = ["poetry-core>=1.0.0"]

test_sentinel.py

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import copy
55
import pickle
6+
from pathlib import Path
67

78
import pytest
89

@@ -18,6 +19,8 @@
1819
# Must be defined at module-level due to limitations in how the pickle module works :/
1920
Pickleable = sentinel.create("Pickleable")
2021

22+
PACKAGE_ROOT = Path(__file__).parent.resolve()
23+
2124

2225
def test_basic_usage():
2326
"""
@@ -173,3 +176,17 @@ def test_can_get_instance_from_class():
173176
MySentinel = sentinel.create("MySentinel")
174177
MySenintelType = type(MySentinel)
175178
assert MySenintelType.instance is MySentinel
179+
180+
181+
def test_version_number():
182+
"""
183+
Ensure the version number in the package matches what's in the pyproject.toml.
184+
"""
185+
import toml # type: ignore
186+
187+
from sentinel import __version__ as version
188+
189+
config_file = PACKAGE_ROOT / "pyproject.toml"
190+
assert config_file.exists()
191+
pyproject = toml.load(config_file)
192+
assert pyproject["tool"]["poetry"]["version"] == version

0 commit comments

Comments
 (0)