Compare commits

..
2 Commits
Author SHA1 Message Date
arcanis 7a2d8299ad cleanup pyproject 2026-07-16 10:18:45 +03:00
arcanis 60850bfc10 reformat tomls 2026-07-16 10:11:16 +03:00
7 changed files with 48 additions and 58 deletions
+4 -4
View File
@@ -47,7 +47,7 @@ stats = [
"matplotlib", "matplotlib",
] ]
unixsocket = [ unixsocket = [
"requests-unixsocket2", "requests-unixsocket2", # required by unix socket support
] ]
validator = [ validator = [
"cerberus", "cerberus",
@@ -61,9 +61,6 @@ Documentation = "https://ahriman.readthedocs.io/"
Repository = "https://github.com/arcan1s/ahriman" Repository = "https://github.com/arcan1s/ahriman"
Changelog = "https://github.com/arcan1s/ahriman/releases" Changelog = "https://github.com/arcan1s/ahriman/releases"
[tool.hatch.version]
path = "src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
packages = [ packages = [
"src/ahriman", "src/ahriman",
@@ -72,3 +69,6 @@ packages = [
[tool.hatch.build.targets.wheel.shared-data] [tool.hatch.build.targets.wheel.shared-data]
"package/lib" = "lib" "package/lib" = "lib"
"package/share" = "share" "package/share" = "share"
[tool.hatch.version]
path = "src/ahriman/__init__.py"
+4 -7
View File
@@ -25,16 +25,13 @@ Documentation = "https://ahriman.readthedocs.io/"
Repository = "https://github.com/arcan1s/ahriman" Repository = "https://github.com/arcan1s/ahriman"
Changelog = "https://github.com/arcan1s/ahriman/releases" Changelog = "https://github.com/arcan1s/ahriman/releases"
[tool.hatch.version]
path = "../ahriman-core/src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
only-include = [ packages = [
"src/ahriman", "src/ahriman",
] ]
sources = [
"src",
]
[tool.hatch.build.targets.wheel.shared-data] [tool.hatch.build.targets.wheel.shared-data]
"package/share" = "share" "package/share" = "share"
[tool.hatch.version]
path = "../ahriman-core/src/ahriman/__init__.py"
+5 -8
View File
@@ -32,7 +32,7 @@ auth = [
] ]
docs = [ docs = [
"aiohttp-apispec", "aiohttp-apispec",
"setuptools", "setuptools", # required by aiohttp-apispec
] ]
metrics = [ metrics = [
"aiohttp-openmetrics", "aiohttp-openmetrics",
@@ -47,17 +47,14 @@ Documentation = "https://ahriman.readthedocs.io/"
Repository = "https://github.com/arcan1s/ahriman" Repository = "https://github.com/arcan1s/ahriman"
Changelog = "https://github.com/arcan1s/ahriman/releases" Changelog = "https://github.com/arcan1s/ahriman/releases"
[tool.hatch.version]
path = "../ahriman-core/src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
only-include = [ packages = [
"src/ahriman", "src/ahriman",
] ]
sources = [
"src",
]
[tool.hatch.build.targets.wheel.shared-data] [tool.hatch.build.targets.wheel.shared-data]
"package/lib" = "lib" "package/lib" = "lib"
"package/share" = "share" "package/share" = "share"
[tool.hatch.version]
path = "../ahriman-core/src/ahriman/__init__.py"
+5 -1
View File
@@ -56,17 +56,21 @@ tests = [
[tool.hatch.build.targets.sdist] [tool.hatch.build.targets.sdist]
exclude = [ exclude = [
"/.github", "/.github",
"/archlinux",
"/docker", "/docker",
"/package/archlinux", "/docs",
"/recipes", "/recipes",
"/tools", "/tools",
"tests",
"/.bandit.yml", "/.bandit.yml",
"/.dockerignore", "/.dockerignore",
"/.pylint.toml", "/.pylint.toml",
"/.readthedocs.yml", "/.readthedocs.yml",
"/conftest.py",
"/github-logo.png", "/github-logo.png",
"/tox.toml", "/tox.toml",
"/toxfile.py", "/toxfile.py",
"/web.png",
] ]
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
+30 -38
View File
@@ -3,6 +3,36 @@ from pathlib import Path
from ahriman.core.utils import walk from ahriman.core.utils import walk
def _test_path(source_root: Path, source_file: Path) -> Path:
"""
generate expected test path for source file
Args:
source_root(Path): package source root
source_file(Path): source file
Returns:
Path: expected test file path
"""
relative_path = source_file.relative_to(source_root)
match relative_path.parts:
# some workaround for well known files
case ("ahriman", "application", "handlers", *_, source_name) if source_name != "handler.py":
return relative_path.parent / f"test_handler_{source_name}"
case ("ahriman", "web", "views", "api", source_name):
return relative_path.parent / f"test_view_api_{source_name}"
case ("ahriman", "web", "views", version, api, source_name) if version in ("v1", "v2"):
return relative_path.parent / f"test_view_{version}_{api}_{source_name}"
case ("ahriman", "web", "views", *_, source_name):
if source_name.endswith("_guard.py"):
return relative_path.parent / f"test_{source_name}"
else:
return relative_path.parent / f"test_view_{source_name}"
case _:
return relative_path.parent / f"test_{source_file.name}"
def test_test_coverage() -> None: def test_test_coverage() -> None:
""" """
must have test files for each source file must have test files for each source file
@@ -19,41 +49,3 @@ def test_test_coverage() -> None:
for source_file in filter(lambda fn: fn.suffix == ".py" and fn.name != "__init__.py", walk(source_root)): for source_file in filter(lambda fn: fn.suffix == ".py" and fn.name != "__init__.py", walk(source_root)):
test_file = package_root / "tests" / _test_path(source_root, source_file) test_file = package_root / "tests" / _test_path(source_root, source_file)
assert test_file.is_file(), test_file assert test_file.is_file(), test_file
def _test_path(source_root: Path, source_file: Path) -> Path:
"""
generate expected test path for source file
Args:
source_root(Path): package source root
source_file(Path): source file
Returns:
Path: expected test file path
"""
relative_path = source_file.relative_to(source_root)
match relative_path.parts:
# some workaround for well known files
case ("ahriman", "application", "handlers", *_, filename) if filename != "handler.py":
filename = f"test_handler_{source_file.name}"
test_parent = Path("ahriman", "application", "handlers")
case ("ahriman", "web", "views", _, filename) if (api := relative_path.parts[3]) == "api":
filename = f"test_view_{api}_{source_file.name}"
test_parent = relative_path.parent
case ("ahriman", "web", "views", _, _, filename) if (version := relative_path.parts[3]) in ("v1", "v2"):
api = relative_path.parts[4]
filename = f"test_view_{version}_{api}_{source_file.name}"
test_parent = relative_path.parent
case ("ahriman", "web", "views", *_, filename):
if source_file.name.endswith("_guard.py"):
filename = f"test_{source_file.name}"
else:
filename = f"test_view_{source_file.name}"
test_parent = relative_path.parent
case _:
filename = f"test_{source_file.name}"
test_parent = relative_path.parent
return test_parent / filename