Repository navigation
Commit e1be239
fix(tests): restore forecast_minutes/minutes_now leaked by two tests (#5079)
test_load_forecast_history and test_rate_text_scan both mutate
forecast_minutes/minutes_now (and, for the latter, end_record/rate_min/
rate_max/rate_import) on the shared PredBat fixture without restoring
them, and each leaked value poisons whichever unrelated test happens to
run next depending on shuffle order.
load_forecast_history's leak specifically comes from its own trailing
restore block calling fetch_config_options(), which re-derives
forecast_minutes from apps.yaml (2880) rather than putting back the
fixture's overridden value (1440) - a bug in the cleanup itself, not
just a missing one. rate_text_scan restored nothing at all.
Snapshotting and restoring these fields (following the try/finally
pattern already used in test_inverter.py) retires 8 of the 27 known
ordering-dependent pairs tracked on #5079 in one structural change per
file, rather than patching each victim individually:
load_forecast_history -> model_kernel
load_forecast_history -> iboost_smart
load_forecast_history -> model
load_forecast_history -> optimise_windows_kernel
rate_text_scan -> cloud_modulation
rate_text_scan -> optimise_swap_charge
rate_text_scan -> window_sort
manual_soc -> cloud_modulation
Verified against all 27 known pairs (not just these 8) via
./run_shuffle, and the full ./run_all --quick suite still passes.
19 pairs remain, tracked on #5079.
Amended per Copilot review on this PR: test_load_forecast_history's
cleanup was still missing several other mutated fixture attributes
(now_utc, midnight_utc, load_minutes, load_minutes_age,
car_charging_threshold, car_charging_rate, base_load,
car_charging_hold, days_previous, days_previous_weight, forecast_days,
holiday_days_left, prefix) - audited the whole function (every
my_predbat.X assignment now has a matching snapshot+restore) rather
than only the fields needed for the 8 pairs above. Doesn't retire any
additional known pairs on its own; it closes latent gaps that could
surface as a future one.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 0f22ee1 commit e1be239
2 files changed
Lines changed: 89 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
86 | 109 | | |
87 | 110 | | |
88 | 111 | | |
| |||
521 | 544 | | |
522 | 545 | | |
523 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
524 | 563 | | |
525 | 564 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
53 | 71 | | |
54 | 72 | | |
55 | 73 | | |
0 commit comments