From 52fd8217f52bbb5343c424f4e4dc2b72dd129679 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Fri, 9 Oct 2026 19:24:34 +0200 Subject: [PATCH] test: pin credit time in TestRealLedgers so the grace floor can't win after 19:00 Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_018RHwVPyiiQMPh4M3JQwQku --- screen_locker/tests/test_shutdown_flat_earners.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/screen_locker/tests/test_shutdown_flat_earners.py b/screen_locker/tests/test_shutdown_flat_earners.py index 25e586e..881288b 100644 --- a/screen_locker/tests/test_shutdown_flat_earners.py +++ b/screen_locker/tests/test_shutdown_flat_earners.py @@ -145,8 +145,11 @@ class TestANewlyRegisteredEarner: class TestRealLedgers: def test_signed_credits_on_disk_reach_the_reset(self, tmp_path: Path) -> None: """No mock between the ledgers and the written hour.""" - write_ledger(earned_time.LEETCODE, [credit(earned_time.LEETCODE)]) - write_ledger(earned_time.READING, [credit(earned_time.READING)]) + # Pinned to local midnight: stamped "now", the grace floor (first + # credit + GRACE_MINUTES) beats base+120 whenever this runs after ~19:00. + midnight = datetime.now(tz=UTC).astimezone().replace(hour=0, minute=0, second=0) + write_ledger(earned_time.LEETCODE, [credit(earned_time.LEETCODE, midnight)]) + write_ledger(earned_time.READING, [credit(earned_time.READING, midnight)]) state = tmp_path / "state.json" mixin = _mixin() with signing_key(tmp_path):