test: cover the validator, the directory and the site
This commit is contained in:
parent
003bb0b4b1
commit
1e75a69381
44 changed files with 1796 additions and 0 deletions
35
tests/test_site.py
Normal file
35
tests/test_site.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"""The project's own pages. Every one of them has to follow the spec."""
|
||||
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from mews.lint import validate_file
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
PAGES = [*sorted((ROOT / "site").glob("*.html")), ROOT / "sample" / "sample.html"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("page", PAGES, ids=lambda p: p.name)
|
||||
def test_the_projects_own_pages_conform(page):
|
||||
report = validate_file(str(page))
|
||||
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))
|
||||
assert not report.warnings, "\n".join(str(f) for f in report.warnings)
|
||||
|
||||
|
||||
def test_the_dtd_still_matches_the_spec():
|
||||
"""dtd/check_dtd.py is hand-maintained; keep it running in CI."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, str(ROOT / "dtd" / "check_dtd.py")],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert result.returncode == 0, result.stderr
|
||||
Loading…
Add table
Add a link
Reference in a new issue