From 95bb214155c587f2c9f829b6183dbe1d379ac7d8 Mon Sep 17 00:00:00 2001 From: glenn schrooyen Date: Thu, 5 Nov 2026 11:02:08 +0100 Subject: [PATCH] TEST-37: test_opt34 builds the first Controller under the scenario clock The stale_live scenario stores a latch ending 2026-11-04 07:15 CET. The first Controller was built before the datetime patch, so Controller.__init__ judged that latch against the real clock and it expired on 2026-11-04. Build it after the patch (clock = scenario start), as the restart path already did. Test-only. Co-Authored-By: Claude --- goodwe_controller/test_opt34.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/goodwe_controller/test_opt34.py b/goodwe_controller/test_opt34.py index bf83d36..869e7fc 100644 --- a/goodwe_controller/test_opt34.py +++ b/goodwe_controller/test_opt34.py @@ -347,7 +347,6 @@ def run_night(spec): async def go(): cur = store - c = build(cur) real_dt, real_hv = m.datetime, homeview.datetime class _DT(real_dt): @@ -357,6 +356,10 @@ def run_night(spec): m.datetime = homeview.datetime = _DT try: + # TEST-37: built under the scenario's clock, not the real one: + # Controller.__init__ checks a stored latch's end against now(). + clock[0] = start + c = build(cur) for t_pre in EVENING: clock[0] = t_pre await c._read_forecast()