Add assert-based pytest coverage for recent fixes

- tests/conftest.py: put repo root on sys.path so `import src...` resolves
  under pytest regardless of invocation directory.
- test_matrix_formatting.py: lock in HTML formatted_body + plain-text fallback,
  URL linkification, HTML escaping, and send_alert field rendering.
- test_station_persistence.py: cover default-load, save/reload round-trip
  (incl. Thai text), runtime-file precedence, and atomic-write cleanup.

These are real assert-based tests (unlike the existing print-style scripts) so
CI can gate on them. 13 tests, all passing.
This commit is contained in:
2026-07-22 14:02:06 +07:00
parent ce31a5254e
commit 12b7f9f422
3 changed files with 187 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
"""Shared pytest configuration.
Ensures the repository root is on sys.path so tests can import the ``src``
package regardless of the working directory pytest is invoked from.
"""
import os
import sys
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if REPO_ROOT not in sys.path:
sys.path.insert(0, REPO_ROOT)