1
0
mirror of https://github.com/enpaul/keyosk.git synced 2024-11-05 06:07:06 +00:00
keyosk/tests/test_metadata.py
Ethan Paul ca891dd1fb
Overhaul repository with newest bestest practices
Add typing stub file
Add metadata tests
Add missing dev dependencies
Add merge conflict check pre-commit
Add tox env for py3.9
Update license from MIT to GPL3
Update pyproject with pypi metadata
Update makefile to reduce duplication and add missing targets
Update dependencies to latest versions
Update pre-commit config to piggy back on poetry env
Update pyproject to use poetry-core
Update toxfile to use locked dependencies
Remove unused codeowners file
Remove placeholder test
2020-11-26 01:33:41 -05:00

38 lines
1.2 KiB
Python

"""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
from keyosk import __about__
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)
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__
assert (
all(
item in __about__.__authors__
for item in pyproject["tool"]["poetry"]["authors"]
)
is True
)
assert (
all(
item in pyproject["tool"]["poetry"]["authors"]
for item in __about__.__authors__
)
is True
)