2020-03-09 04:15:39 +00:00
|
|
|
"""Test that about module matches pyproject
|
|
|
|
|
|
|
|
Currently poetry does not have a way to access meta info about a module/package
|
|
|
|
at runtime from within the package itself (without installing poetry as a dependency
|
|
|
|
of every project). To get around this, we could ship the ``pyproject.toml`` along with
|
|
|
|
the sdist and wheels, which seems clumsy, or we can create the semi-standard
|
|
|
|
``__about__.py`` and enforce consistency through a test that will let us know if the two
|
|
|
|
are not equal to each other
|
|
|
|
"""
|
2020-02-23 17:53:45 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import toml
|
|
|
|
|
|
|
|
from keyosk import __about__
|
|
|
|
|
|
|
|
|
2020-03-09 04:15:39 +00:00
|
|
|
with Path(".", "pyproject.toml").open() as infile:
|
|
|
|
PYPROJECT = toml.load(infile)
|
2020-02-23 17:53:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_version():
|
2020-03-09 04:15:39 +00:00
|
|
|
assert __about__.__version__ == PYPROJECT["tool"]["poetry"]["version"]
|
2020-02-23 17:53:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_title():
|
2020-03-09 04:15:39 +00:00
|
|
|
assert __about__.__title__ == PYPROJECT["tool"]["poetry"]["name"]
|