screen-locker/screen_locker
Krzysztof kuhy Rudnicki 8429cf04d5
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
Fix ScreenLocker test-factory log_file isolation flake
create_locker (+ _relaxed_day / _early_bird variants) patched
Path.resolve to return tmp_path, but ScreenLocker.__init__ computes
script_dir = Path(__file__).resolve().parent — the .parent turned the
intended per-test tmp_path into tmp_path.parent, pytest's session-shared
temp base. Every factory-built locker therefore shared ONE
workout_log.json, so any test that wrote a log polluted it and
test_saves_pending_marker's `assert not locker.log_file.exists()`
passed or failed purely by random ordering (pytest-randomly).

The flake was invisible until now because CI died at conftest import
(missing crdt_sync) before any test ran; fixing that import in the prior
commit exposed it. Reproduced deterministically at CI seed 2701400184.

Fix: resolve() now returns tmp_path / "screen_locker" so .parent is the
unique per-test tmp_path — each locker gets its own log_file. Also stops
tests writing workout_log.json into the real source tree. Verified 747
passed across seeds 2701400184/1/42/999/123456 (was 1 failed at the CI
seed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PMRRVVkeRyrSaaqueMZKG
2026-07-11 17:20:01 +02:00
..
tests Fix ScreenLocker test-factory log_file isolation flake 2026-07-11 17:20:01 +02:00
__init__.py Fix test discovery and coverage for python_pkg modules 2025-12-02 22:33:34 +01:00
_auto_upgrade.py Fix pre-existing CI failures (crdt_sync dep, dead type:ignore, ruff) 2026-07-11 17:05:03 +02:00
_compliance_state.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
_constants.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
_early_bird.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_extra_benefits.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_heat_skip.py Fix pre-existing CI failures (crdt_sync dep, dead type:ignore, ruff) 2026-07-11 17:05:03 +02:00
_log_mixin.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_manual_workout_dialog.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_manual_workout.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_mcp.py Add read-only MCP server exposing workout/lock status 2026-07-10 21:28:09 +02:00
_phone_verification.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
_runnerup_db.py Fix pre-existing CI failures (crdt_sync dep, dead type:ignore, ruff) 2026-07-11 17:05:03 +02:00
_runnerup_verification.py Add auto-fill RunnerUp scan, carrot bonuses, and --status interface 2026-06-28 08:08:35 +02:00
_shutdown_base.py Add auto-fill RunnerUp scan, carrot bonuses, and --status interface 2026-06-28 08:08:35 +02:00
_shutdown.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_sick_dialog.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_sick_tracker.py Fix silent skip-credit bypass; replace with weekly shutdown-time bonus 2026-07-03 15:27:08 +02:00
_status_data.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_status.py Fix pre-existing CI failures (crdt_sync dep, dead type:ignore, ruff) 2026-07-11 17:05:03 +02:00
_temperature_status_mixin.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
_temperature.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
_time_check.py chore: set up as standalone repo 2026-05-28 07:43:06 +02:00
_ui_flows_relaxed.py refactor: enforce 400-line file limit with pre-commit hook and split outliers 2026-05-28 21:19:18 +02:00
_ui_flows.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_ui_widgets.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_wake_state.py Migrate to the shared gatelock backend 2026-06-21 20:11:16 +02:00
_weekly_check.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_window_setup.py Migrate to the shared gatelock backend 2026-06-21 20:11:16 +02:00
_workout_credit.py Add manual (unverified) workout logging with evidence form 2026-07-05 20:08:52 +02:00
_workout_sync.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
adjust_shutdown_schedule.sh fix: resolve shutdown-schedule canonical path via guardctl dynamically 2026-07-04 11:48:39 +02:00
screen_lock.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00
status_view.py Add phone-workout GitHub sync via shared crdt_sync (Workstream C) 2026-07-11 00:06:59 +02:00