Set up pytest and coverage tooling
This commit is contained in:
@@ -2,3 +2,5 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
*.egg-info
|
*.egg-info
|
||||||
*.pyc
|
*.pyc
|
||||||
|
.coverage
|
||||||
|
htmlcov/
|
||||||
|
|||||||
@@ -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*"]
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user