refactor: split the repo into self-contained validator, directory, quickstart, spec and site folders
validator/ holds mewslint (lint, css, fetch, DTD/CSS data); directory/ holds the mews.page service (app, db, check, pages, cli) and depends on validator/; quickstart/ holds mews-quickstart and md2mews.py for third parties who want to create Mews content without cloning the repo; spec/ consolidates doc/ and dtd/ with the canonical mews-0.1.css; site/ becomes a Pelican project with the forward-facing pages as Markdown, the check form kept as a raw HTML snippet. Root pyproject.toml is now a virtual uv workspace over validator, directory and quickstart, with cross-cutting tests that span more than one of them staying at the repo root. Makefile and flake.nix updated to match.
This commit is contained in:
parent
5fa8708bd1
commit
060d4e00fd
90 changed files with 1290 additions and 287 deletions
|
|
@ -1,6 +1,7 @@
|
|||
"""The project's own pages. Every one of them has to follow the spec."""
|
||||
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
|
@ -9,18 +10,48 @@ import pytest
|
|||
from mews.lint import validate_file
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
PAGES = [*sorted((ROOT / "site").glob("*.html")), ROOT / "sample" / "sample.html"]
|
||||
SITE = ROOT / "site"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("page", PAGES, ids=lambda p: p.name)
|
||||
def test_the_projects_own_pages_conform(page):
|
||||
report = validate_file(str(page))
|
||||
@pytest.fixture(scope="session")
|
||||
def built_site():
|
||||
"""Build the Pelican site once per test session, and return its output dir."""
|
||||
result = subprocess.run(
|
||||
[shutil.which("uv"), "run", "pelican", "content", "-o", "output"],
|
||||
cwd=SITE,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert result.returncode == 0, result.stderr
|
||||
return SITE / "output"
|
||||
|
||||
|
||||
@pytest.mark.skipif(shutil.which("uv") is None, reason="uv is not installed")
|
||||
@pytest.mark.slow
|
||||
def test_the_sites_own_pages_conform(built_site):
|
||||
pages = sorted(built_site.glob("*.html"))
|
||||
assert pages, "the site build produced no pages"
|
||||
for page in pages:
|
||||
report = validate_file(str(page))
|
||||
assert report.conforms, "\n".join(str(f) for f in report.failures)
|
||||
|
||||
|
||||
@pytest.mark.skipif(shutil.which("uv") is None, reason="uv is not installed")
|
||||
@pytest.mark.slow
|
||||
def test_the_sites_own_pages_have_no_warnings_either(built_site):
|
||||
for page in sorted(built_site.glob("*.html")):
|
||||
report = validate_file(str(page))
|
||||
assert not report.warnings, "\n".join(str(f) for f in report.warnings)
|
||||
|
||||
|
||||
def test_the_sample_page_conforms():
|
||||
report = validate_file(str(ROOT / "sample" / "sample.html"))
|
||||
assert report.conforms, "\n".join(str(f) for f in report.failures)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("page", PAGES, ids=lambda p: p.name)
|
||||
def test_the_projects_own_pages_have_no_warnings_either(page):
|
||||
report = validate_file(str(page))
|
||||
def test_the_sample_page_has_no_warnings_either():
|
||||
report = validate_file(str(ROOT / "sample" / "sample.html"))
|
||||
assert not report.warnings, "\n".join(str(f) for f in report.warnings)
|
||||
|
||||
|
||||
|
|
@ -37,9 +68,9 @@ def test_pages_the_pelican_plugin_produces_conform(page):
|
|||
|
||||
|
||||
def test_the_dtd_still_matches_the_spec():
|
||||
"""dtd/check_dtd.py is hand-maintained; keep it running in CI."""
|
||||
"""spec/check_dtd.py is hand-maintained; keep it running in CI."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, str(ROOT / "dtd" / "check_dtd.py")],
|
||||
[sys.executable, str(ROOT / "spec" / "check_dtd.py")],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue