add tests for config, fix failing test on Site

This commit is contained in:
2026-09-08 04:37:13 +02:00
parent ea14de6200
commit ab14def478
2 changed files with 191 additions and 19 deletions
+3 -19
View File
@@ -3,21 +3,6 @@ import pytest
from omicron.ssg.output import ContentError, Directory, OutputError
from omicron.ssg.site import ConfigError, 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
def test_discover_raises_on_duplicate_destination(make_site):
site = make_site("duplicate_slug")
@@ -58,13 +43,12 @@ def test_read_config_errors(site_dir):
Site(path)
def test_build_raises_for_relative_base_url(site_dir):
def test_site_relative_base_url(site_dir):
path = site_dir("thin_site")
(path / "config.yml").write_text("name: test\ntemplate: plain\nbase_url: blog\n")
site = Site(path)
with pytest.raises(ConfigError, match="absolute path"):
site.build()
with pytest.raises(ConfigError, match="relative path"):
site = Site(path)
def test_discover_skips_drafts_by_default(make_site):