Skip to content

Commit

Permalink
test: __version__ matches package's actual version
Browse files Browse the repository at this point in the history
  • Loading branch information
eddieantonio committed Jul 23, 2022
1 parent 526ca4a commit 8bdead8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ varname = ["varname"]
pytest = "^6.2.1"
mypy = "^0.971"
black = "^20.8b1"
toml = "*"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
17 changes: 17 additions & 0 deletions test_sentinel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import copy
import pickle
from pathlib import Path

import pytest

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

PACKAGE_ROOT = Path(__file__).parent.resolve()


def test_basic_usage():
"""
Expand Down Expand Up @@ -173,3 +176,17 @@ def test_can_get_instance_from_class():
MySentinel = sentinel.create("MySentinel")
MySenintelType = type(MySentinel)
assert MySenintelType.instance is MySentinel


def test_version_number():
"""
Ensure the version number in the package matches what's in the pyproject.toml.
"""
import toml # type: ignore

from sentinel import __version__ as version

config_file = PACKAGE_ROOT / "pyproject.toml"
assert config_file.exists()
pyproject = toml.load(config_file)
assert pyproject["tool"]["poetry"]["version"] == version

0 comments on commit 8bdead8

Please sign in to comment.