testsAndMisc/articles/test_site_size.py
Krzysztof kuhy Rudnicki d22619b483 fix(lint): convert os.path to pathlib - remove PTH per-file ignores
- Converted os.path patterns to pathlib.Path in 15+ files
- os.path.join → Path /
- os.path.dirname → Path.parent
- os.path.exists → Path.exists()
- os.path.isfile → Path.is_file()
- os.path.abspath → Path.resolve()
- os.mkdir → Path.mkdir()
- os.listdir → Path.iterdir()
- os.getcwd → Path.cwd()
- os.replace → Path.replace()
- Updated function type hints to accept str | Path

Added PTH123 (open() vs Path.open()) to global ignores as stylistic preference
2025-11-30 23:03:03 +01:00

21 lines
596 B
Python

"""Tests to ensure website stays within size budget."""
from pathlib import Path
# Budget for the entire website (single file) in bytes
BUDGET = 14 * 1024 # 14 KiB
HERE = Path(__file__).parent
SITE_FILE = HERE / "index.html"
def test_site_file_exists() -> None:
"""Verify the main site HTML file exists."""
assert SITE_FILE.exists(), f"Missing site file: {SITE_FILE}"
def test_site_size_under_budget() -> None:
"""Verify site size is under the defined budget."""
size = SITE_FILE.stat().st_size
assert size <= BUDGET, f"Site size {size} bytes exceeds budget {BUDGET}"