Repository navigation
Commit d48cb22
fix(tests): anchor the energydataservice fixture to Predbat's day, not the host's (#5013)
test_energydataservice built its rate fixture from datetime.now() - the machine's clock -
while reading the timezone offset two lines later from my_predbat.midnight_utc, which is
local midnight in Predbat's configured timezone. Between 23:00 and 00:00 UTC under BST
those land on different dates, so the published rates are a day out from the day the code
is modelling and rates[1440] does not exist: KeyError: 1440.
This is not intermittent. The nightly journal flush runs at local midnight, which during
BST is 23:0x UTC, so it lands in the failing hour every night - PR #5011 is a docs-only
change that failed CI for exactly this reason, at 23:12 UTC.
Same trap and same fix as PR #4998 for the multi-car IOG tests, and the trap already has
a bullet in the debug journal ("Build test dates from Predbat's clock, not the machine's").
Verified by running the suite with TZ=Pacific/Pitcairn, which puts the host a calendar day
behind Europe/London: energydataservice reproduces the KeyError before the change and
passes after, as does the full quick suite (82.98s, 4 slow tests skipped). It also still
passes on an unshifted clock.
The suite aborts on the first uncaught exception, so this was masking anything later in
the run; with it fixed, nothing else in the quick suite fails in that window. Nineteen
other test files call datetime.now(), none of them currently affected, but the pattern is
latent - a scheduled CI run in a shifted timezone would catch the next one before a
maintainer does.
Co-authored-by: CI <ci@example.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent eb9e1e1 commit d48cb22
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| |||
0 commit comments