mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 12:26:19 -05:00
Fallout: say a forecast's last hour is held only when it is; check kept climatology months (#1016)
The winds follow the burst hour chosen, so an out-of-date forecast's last hour is held for the whole simulation only when it is the hour chosen; otherwise from when the chosen hour's 48 hours pass it, or not at all. The panel now says just that, and says separately that the forecast is out of date. A kept climatology month is hashed against its pinned sha256 before it is listed or served (again only once it changes); one that is not what is expected is fetched again. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d4d288f84a
commit
3ae978dc53
4 changed files with 69 additions and 16 deletions
|
|
@ -116,3 +116,21 @@ async def test_worker_waits_for_internet_and_drive(test_directory, published, fl
|
|||
flags.media_mounted.set()
|
||||
await asyncio.wait_for(worker, timeout=5)
|
||||
fetch.assert_awaited_once()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_month_kept_must_be_what_is_expected(test_directory, published):
|
||||
"""A kept month that is changed, or replaced, is not listed or served, and is fetched again."""
|
||||
data, bodies = published
|
||||
get, asked = fake_get(bodies)
|
||||
with mock.patch('modules.map.climatology.aiohttp_get', get), mock.patch('modules.map.climatology.asyncio.sleep'):
|
||||
await climatology.fetch_missing()
|
||||
path = climatology.month_path(1)
|
||||
assert path
|
||||
|
||||
path.write_bytes(gzip.compress(b'WFCL another month'))
|
||||
assert climatology.month_path(1) is None
|
||||
assert climatology.months_kept() == [2]
|
||||
|
||||
assert await climatology.fetch_missing() == [1]
|
||||
assert climatology.month_path(1).read_bytes() == data[1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue