From 81284f160bc25985eac097aee4550dd95bc987d4 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Fri, 18 Sep 2026 10:07:11 +0200 Subject: [PATCH] Pin the clock in the sync-degradation tests; CI ran them inside the early-bird window Co-Authored-By: Claude Opus 5 (1M context) --- screen_locker/tests/test_sync_degradation.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/screen_locker/tests/test_sync_degradation.py b/screen_locker/tests/test_sync_degradation.py index 6498ef9..f358305 100644 --- a/screen_locker/tests/test_sync_degradation.py +++ b/screen_locker/tests/test_sync_degradation.py @@ -14,6 +14,7 @@ them justifies taking the screen away. from __future__ import annotations +from datetime import UTC, datetime from pathlib import Path from typing import TYPE_CHECKING @@ -47,12 +48,19 @@ class TestUnreadableSourceIsNotNoWorkout: "early_bird_pending_file": tmp_path / "early_bird_pending.json", } + # Local noon: outside the 05:00-08:30 early-bird window on any clock. CI + # runs around 08:00 UTC, and unpinned that landed inside the window on + # the runner, so the chain stopped at "early-bird window open" before it + # ever reached the degraded-source verdict these tests are about. + _NOON = datetime.now(tz=UTC).astimezone().replace(hour=12, minute=0) + def test_lock_reports_unreadable_source_not_absent_workout( self, tmp_path: Path ) -> None: """An empty log plus a dead backend must not read as "you did nothing".""" result = explain_lock_decision( **self._files(tmp_path), + now=self._NOON, sick_history=SickHistory(), extended_early_bird=False, weekly_minimum_met=False, @@ -67,6 +75,7 @@ class TestUnreadableSourceIsNotNoWorkout: """With every backend answering, an empty log really does mean none.""" result = explain_lock_decision( **self._files(tmp_path), + now=self._NOON, sick_history=SickHistory(), extended_early_bird=False, weekly_minimum_met=False,