Set up pytest and coverage tooling

This commit is contained in:
2026-08-28 01:15:28 +02:00
parent 34df950cbd
commit 6afc8585db
3 changed files with 32 additions and 0 deletions
+2
View File
@@ -2,3 +2,5 @@
__pycache__ __pycache__
*.egg-info *.egg-info
*.pyc *.pyc
.coverage
htmlcov/
+11
View File
@@ -17,7 +17,9 @@ dependencies = [
dev = [ dev = [
"beartype", "beartype",
"black", "black",
"coverage",
"mypy", "mypy",
"pytest",
"types-PyYAML", "types-PyYAML",
"types-Pygments", "types-Pygments",
] ]
@@ -31,6 +33,15 @@ target-version = ["py314"]
[tool.mypy] [tool.mypy]
strict = true strict = true
[tool.pytest.ini_options]
testpaths = ["tests"]
[tool.coverage.run]
source = ["omicron"]
[tool.coverage.report]
show_missing = true
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
where = ["."] where = ["."]
include = ["omicron.ssg*"] include = ["omicron.ssg*"]
+19
View File
@@ -0,0 +1,19 @@
from pathlib import Path
import pytest
from omicron.ssg.site import Site
@pytest.mark.parametrize(
"value, expected_origin, expected_path",
[
(None, "", Path("/")),
("http://example.com/blog", "http://example.com", Path("/blog")),
("http://example.com", "http://example.com", Path("/")),
("//example.com/blog", "//example.com", Path("/blog")),
("/blog", "", Path("/blog")),
],
)
def test_parse_base_url(value, expected_origin, expected_path):
origin, path = Site.parse_base_url(value)
assert origin == expected_origin
assert path == expected_path