Set up pytest and coverage tooling
This commit is contained in:
@@ -2,3 +2,5 @@
|
||||
__pycache__
|
||||
*.egg-info
|
||||
*.pyc
|
||||
.coverage
|
||||
htmlcov/
|
||||
|
||||
@@ -17,7 +17,9 @@ dependencies = [
|
||||
dev = [
|
||||
"beartype",
|
||||
"black",
|
||||
"coverage",
|
||||
"mypy",
|
||||
"pytest",
|
||||
"types-PyYAML",
|
||||
"types-Pygments",
|
||||
]
|
||||
@@ -31,6 +33,15 @@ target-version = ["py314"]
|
||||
[tool.mypy]
|
||||
strict = true
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
|
||||
[tool.coverage.run]
|
||||
source = ["omicron"]
|
||||
|
||||
[tool.coverage.report]
|
||||
show_missing = true
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
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