mirror of
https://github.com/enpaul/keyosk.git
synced 2024-12-25 17:23:31 +00:00
Update about file with less sketchy loading system
Remove importlib usage from about file Add tests to enforce data consistency between pyproject and about Update sphinx config to use new about file Remove pyproject from package
This commit is contained in:
parent
1dd27b6169
commit
f6185ba82d
@ -13,7 +13,7 @@ with open(Path(BASE_DIR, "..", "keyosk", "__about__.py")) as infile:
|
||||
|
||||
project = ABOUT["__title__"]
|
||||
copyright = "2019, Ethan Paul"
|
||||
author = ", ".join(ABOUT["__authors__"])
|
||||
author = "Ethan Paul <e@enp.one>"
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = ABOUT["__version__"]
|
||||
|
@ -1,12 +1,3 @@
|
||||
"""Access package info programatically without duplication"""
|
||||
import importlib.resources
|
||||
|
||||
import toml
|
||||
|
||||
PYPROJECT = toml.loads(importlib.resources.read_text("keyosk", "pyproject.toml"))
|
||||
|
||||
__authors__ = PYPROJECT["tool"]["poetry"]["authors"]
|
||||
__summary__ = PYPROJECT["tool"]["poetry"]["description"]
|
||||
__title__ = PYPROJECT["tool"]["poetry"]["name"]
|
||||
__url__ = PYPROJECT["tool"]["poetry"]["repository"]
|
||||
__version__ = PYPROJECT["tool"]["poetry"]["version"]
|
||||
# pylint: disable=missing-docstring
|
||||
__version__ = "0.1.0-alpha-1"
|
||||
__title__ = "keyosk"
|
||||
|
@ -1 +0,0 @@
|
||||
../pyproject.toml
|
22
tests/test_about.py
Normal file
22
tests/test_about.py
Normal file
@ -0,0 +1,22 @@
|
||||
from pathlib import Path
|
||||
|
||||
import toml
|
||||
|
||||
from keyosk import __about__
|
||||
|
||||
|
||||
PYPROJECT_PATH = Path("pyproject.toml")
|
||||
|
||||
|
||||
def test_version():
|
||||
with PYPROJECT_PATH.open() as infile:
|
||||
pyproject = toml.load(infile)
|
||||
|
||||
assert __about__.__version__ == pyproject["tool"]["poetry"]["version"]
|
||||
|
||||
|
||||
def test_title():
|
||||
with PYPROJECT_PATH.open() as infile:
|
||||
pyproject = toml.load(infile)
|
||||
|
||||
assert __about__.__title__ == pyproject["tool"]["poetry"]["name"]
|
Loading…
Reference in New Issue
Block a user