The test_run_once_* cases were flaky/order-dependent. Root cause: observer.observer derives OBSERVER_STATE_FILE from STATE_DIR at import time. The helper patched STATE_DIR but never OBSERVER_STATE_FILE, so run_once()/_save_checkpoint() wrote the checkpoint to the real /opt/homelab/state/observer_checkpoint.json. Those node_checkpoints (tmp paths tagged with a pytest run number) leaked across tests and across pytest runs; run_once's `file_path > checkpoint` string compare then skipped/kept events based on run-number ordering. The helper also never restored the module globals it overwrote. Replace both ad-hoc helpers with an autouse monkeypatch fixture that redirects every observer path — including OBSERVER_STATE_FILE — into the per-test tmp_path and reverts them afterward. Tests no longer touch real disk and are deterministic. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_incident_lifecycle.py | ||
| test_liveness.py | ||
| test_operator_ui_liveness.py | ||
| test_state_reliability.py | ||
| test_supervisor_ha.py | ||
| test_supervisor_node_events.py | ||