2022-05-21 16:31:15 +00:00
|
|
|
"""Ensure that the pyproject and module metadata never drift out of sync
|
|
|
|
|
|
|
|
The next best thing to having one source of truth is having a way to ensure all of your
|
|
|
|
sources of truth agree with each other.
|
|
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import toml
|
|
|
|
|
2022-05-31 03:02:46 +00:00
|
|
|
from glassy import __about__
|
2022-05-21 16:31:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_metadata():
|
|
|
|
"""Test that module metadata matches pyproject poetry metadata"""
|
|
|
|
|
|
|
|
with (Path(__file__).resolve().parent / ".." / "pyproject.toml").open() as infile:
|
|
|
|
pyproject = toml.load(infile, _dict=dict)
|
|
|
|
|
2022-05-31 03:02:46 +00:00
|
|
|
assert pyproject["tool"]["poetry"]["name"] == __about__.__title__
|
|
|
|
assert pyproject["tool"]["poetry"]["version"] == __about__.__version__
|
|
|
|
assert pyproject["tool"]["poetry"]["license"] == __about__.__license__
|
|
|
|
assert pyproject["tool"]["poetry"]["description"] == __about__.__summary__
|
|
|
|
assert pyproject["tool"]["poetry"]["repository"] == __about__.__url__
|
2022-05-21 16:31:15 +00:00
|
|
|
assert (
|
|
|
|
all(
|
2022-05-31 03:02:46 +00:00
|
|
|
item in __about__.__authors__
|
2022-05-21 16:31:15 +00:00
|
|
|
for item in pyproject["tool"]["poetry"]["authors"]
|
|
|
|
)
|
|
|
|
is True
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
all(
|
|
|
|
item in pyproject["tool"]["poetry"]["authors"]
|
2022-05-31 03:02:46 +00:00
|
|
|
for item in __about__.__authors__
|
2022-05-21 16:31:15 +00:00
|
|
|
)
|
|
|
|
is True
|
|
|
|
)
|