mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-22 02:22:20 +01:00
Keep the test suite's JSONL log out of the live events.jsonl
_logging_setup attaches its JSONL sink the first time an entry point's
main() runs, and the conftest never redirected LOG_JSONL_FILE or
LOG_DEDUPE_FILE. Every suite run appended ~25 fixture warnings ("Synced
alarm out of range: 24:0") to ~/.local/state/wake_alarm/events.jsonl, the
log a failed wake-up is reconstructed from. Patch _logging_setup's names
(it imported them by value) in the autouse _hermetic fixture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0188kZdx3bb56QM8JFUnbHuM
This commit is contained in:
parent
702f37a7ba
commit
16f9ddeb13
@ -14,6 +14,11 @@ an inhibitor:
|
||||
per-file redirect is exactly the kind that gets forgotten when a new writer
|
||||
appears, and the failure is silent -- a green suite that quietly stamped
|
||||
the live state file.
|
||||
* ``_logging_setup`` attaches a JSONL sink to the root logger the first time
|
||||
any entry point's ``main()`` runs, pointed at the real
|
||||
``~/.local/state/wake_alarm/events.jsonl``. Unredirected, every suite run
|
||||
appended fixture warnings ("Synced alarm out of range: 24:0") to the log a
|
||||
failed wake-up is reconstructed from.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@ -37,6 +42,10 @@ def _hermetic(tmp_path: Path) -> Generator[None]:
|
||||
with (
|
||||
patch("gatelock.log_integrity.DEFAULT_HMAC_KEY_FILE", key_file),
|
||||
patch("wake_alarm._state.WAKE_STATE_FILE", tmp_path / "wake_state.json"),
|
||||
# _logging_setup imported these by value, so patch its names, not
|
||||
# _constants'.
|
||||
patch("wake_alarm._logging_setup.LOG_JSONL_FILE", tmp_path / "events.jsonl"),
|
||||
patch("wake_alarm._logging_setup.LOG_DEDUPE_FILE", tmp_path / "last.json"),
|
||||
patch(
|
||||
"wake_alarm._session.MORNING_SESSION_FILE",
|
||||
tmp_path / "morning_session.json",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user