wake-alarm/wake_alarm/tests
Krzysztof kuhy Rudnicki c98055f8a2 Migrate the alarm to gatelock v0.2.0 and give it an escape hatch
Per-output locking: the alarm now paints one full challenge per live
monitor instead of one window on the primary. `_ViewGroup` presents the N
copies as one -- every label update fans out, and because all entries share
a single root-mastered StringVar, answering on whichever screen you are
actually looking at dismisses the alarm everywhere.

The escape hatch is the reason this repo could not stay unmigrated. The
alarm was the only locker with no way out but four correct rounds against a
30-second refresh, which is a lot to ask of someone who has just woken up
and nothing at all to fall back on if the alarm misfires at the wrong hour.
It is deliberately exactly as hard as sick mode: hidden for the first five
minutes so it is never the easy first move, gone entirely once a rolling
budget is spent, and costing a written justification plus a wait that
doubles with each recent use. It grants no workout skip.

`EscapeHatch` owns the whole flow so open and close stay symmetric. That
symmetry is the fix for a real bug: `_open_escape` used to pack_forget the
challenge widgets and cancel only flipped a bool, so "Back to the alarm"
left a dead form on a blank screen, leaked the dialog frame, and made the
next open sweep the dialog instead of the challenge. pack_forget does not
remember its options, so the challenge now lives in one `challenge_frame`
that is forgotten and re-packed as a unit.

Tests: the single-output default made every "on every monitor" assertion
degenerate into 1 == 1, and a shared MagicMock return_value made N surfaces
N references to one widget -- a loop cropped to containers[:1] passed the
whole suite. A `dual_output` fixture plus distinct-identity mocks now cover
all five fan-out loops; each was mutation-checked by cropping it and
confirming the suite goes red. The suite also no longer reads the real
escape history or signs with the production HMAC key.

326 tests, 100% branch coverage, pre-commit clean, no lint suppressions.
2026-07-25 15:35:44 +02:00
..
__init__.py Add tests and fix pre-commit issues across all projects 2026-04-12 20:45:24 +02:00
conftest.py Migrate the alarm to gatelock v0.2.0 and give it an escape hatch 2026-07-25 15:35:44 +02:00
test_alarm_audio.py Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
test_alarm_challenges.py Fire alarm daily, harden dismissal challenge; ignore wake_state.json 2026-07-10 23:14:40 +02:00
test_alarm_display.py Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
test_alarm_part2.py Migrate the alarm to gatelock v0.2.0 and give it an escape hatch 2026-07-25 15:35:44 +02:00
test_alarm_part3.py Migrate the alarm to gatelock v0.2.0 and give it an escape hatch 2026-07-25 15:35:44 +02:00
test_alarm_part4.py Migrate the alarm to gatelock v0.2.0 and give it an escape hatch 2026-07-25 15:35:44 +02:00
test_alarm_playback.py Play alarm audio on every sink, not one hardcoded output 2026-07-11 18:12:39 +02:00
test_alarm_sinks.py Replace sleep-and-hope audio waits with per-cycle presence checks 2026-07-11 18:51:03 +02:00
test_alarm.py Route _alarm.py's dismiss-screen colors through gatelock's LockConfig 2026-07-22 20:09:26 +02:00
test_escape_flow.py Migrate the alarm to gatelock v0.2.0 and give it an escape hatch 2026-07-25 15:35:44 +02:00
test_smart_plug.py Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
test_state.py Extract wake_alarm from testsAndMisc as a standalone repo 2026-06-22 12:31:40 +02:00
test_sync.py Fire the alarm at the phone's time via a per-minute timer 2026-07-19 20:21:17 +02:00
test_trigger.py Fire the alarm at the phone's time via a per-minute timer 2026-07-19 20:21:17 +02:00