Allow local template overrides in the site directory

closes #13
This commit is contained in:
omicron committed 2026-10-20 19:25:55 +02:00
1 parent 7bf04ff064
commit a1ecd0f480
3 files changed
+31 -8

No files matched your search

+22 -2
View File
@@ -78,9 +78,29 @@ def test_clean_removes_output_directory(make_site):
assert not site.output_path.exists()
def test_resolve_template_path_raises_for_missing_template():
def test_resolve_template_path_raises_for_missing_template(site_dir):
path = site_dir("thin_site")
(path / "config.yml").write_text("name: test\ntemplate: does-not-exist\n")
with pytest.raises(ConfigError, match="not found"):
Site.resolve_template_path("does-not-exist")
Site(path)
def test_resolve_template_path_prefers_local_override(site_dir):
path = site_dir("thin_site")
(path / "config.yml").write_text("name: test\ntemplate: plain\n")
local = path / "templates" / "plain"
local.mkdir(parents=True)
assert Site(path).template_path == local
def test_resolve_template_path_falls_back_to_builtin(site_dir):
path = site_dir("thin_site")
(path / "config.yml").write_text("name: test\ntemplate: plain\n")
assert Site(path).template_path.name == "plain"
assert not Site(path).template_path.is_relative_to(path)
def test_home_url(site_dir):