testsAndMisc/python_pkg/articles/tests/test_site_size.py
Krzysztof kuhy Rudnicki 2545d72710 test: achieve 100% branch coverage across all python_pkg packages
- Add comprehensive tests for all packages (3572 tests, 100% branch coverage)
- Split oversized test files to stay under 500-line limit
- Add per-file ruff ignores for test-appropriate suppressions
- Fix _cache_decks.py to properly convert JSON lists to tuples
- Add session-scoped conftest fixture for logging handler cleanup (Python 3.14)
- Update ruff pre-commit hook to v0.15.2
- Add codespell ignore words for test data
- Add generated output files to .gitignore
2026-03-21 17:51:36 +01:00

21 lines
603 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.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}"