testsAndMisc/python_pkg
Krzysztof kuhy Rudnicki 247607e8c3 Fix the real cause of the wake_alarm CI coverage gap
The previous two fix attempts (removing -n 4 xdist parallelism, ruling
out a Python 3.12-vs-3.14 difference) both targeted the wrong cause for
the coverage gap on _alarm_display.py:71. The actual bug:
_restore_display() was never mocked in the _block_extra_devices fixture
shared by test_alarm_part2/3/4.py, so every test exercising
on_close()/_lock.close() ran the REAL _restore_display(), which calls
the REAL shutil.which('xset'). My dev machine has /usr/bin/xset
installed, so it always hit the "found" branch by accident; the CI
runner doesn't, so it always hit the "missing" branch instead, and
there was no dedicated unit test for the "found" path at all.

Fix: mock _restore_display in that fixture (matching its already-mocked
siblings _restore_fans/_restore_alarm_audio/turn_off_plug), and add a
dedicated, hermetic test for the xset-found branch that doesn't depend
on whether the running machine actually has xset on PATH. Side benefit:
the test suite no longer makes a real `xset s on` subprocess call on
the developer's desktop as an untracked side effect of running tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A7vbgtFfZmfxJtN5DdtJky
2026-06-22 09:14:29 +02:00
..
brother_printer feat: split oversized modules for 500-line limit, fix kasa coverage gap 2026-06-14 07:19:37 +02:00
diet_guard Fix non-hermetic diet_guard gate tests depending on a real X display 2026-06-22 08:12:02 +02:00
live_calc refactor: extract all inline Python from shell scripts into proper .py files 2026-06-06 10:31:48 +02:00
morning_routine feat: split oversized modules for 500-line limit, fix kasa coverage gap 2026-06-14 07:19:37 +02:00
random_jpg feat: added run sh and makefile scripts 2026-02-22 22:00:50 +01:00
shared Migrate wake_alarm to the shared gatelock backend 2026-06-22 07:33:49 +02:00
tests refactor: move Python packages under python_pkg/ 2026-03-18 22:54:45 +01:00
wake_alarm Fix the real cause of the wake_alarm CI coverage gap 2026-06-22 09:14:29 +02:00
__init__.py feat(screen_locker): harden table tennis verification, remove running option 2026-02-02 21:38:52 +01:00
.gitignore screen_locker: enhance workout logging and UI 2025-12-02 23:22:13 +01:00
conftest.py test: achieve 100% branch coverage across all python_pkg packages 2026-03-21 17:51:36 +01:00