from __future__ import annotations from pathlib import Path import pytest from smolweb.site import Site @pytest.fixture def site(tmp_path: Path) -> Site: (tmp_path / "index.md").write_text("# Home\n\nHello.\n", encoding="utf-8") (tmp_path / "about.md").write_text("---\ntitle: About\n---\n# About\n\nBody.\n", encoding="utf-8") (tmp_path / "img.png").write_bytes(b"\x89PNG\r\n\x1a\nfake") sub = tmp_path / "dir" sub.mkdir() (sub / "index.md").write_text("# Nested\n\nNested body.\n", encoding="utf-8") (tmp_path / ".secret.md").write_text("# Hidden\n", encoding="utf-8") (tmp_path / "trail.md").write_text( "---\ntitle: Trail\ndeck_per_card: true\n---\n" "Intro line.\n\n" "{.card Weather}\n" "Cold and clear. Permit fee: $5.\n\n" "{.card Status}\n" "- North: open\n", encoding="utf-8", ) return Site(tmp_path)