Fix flakiness of test_measure_sliding_window (#115322)

This commit is contained in:
Collin Fair 2024-04-09 22:28:06 -06:00 committed by GitHub
parent 2fdb420d1a
commit 0636ba340c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1175,6 +1175,13 @@ async def test_measure_sliding_window(
]
}
with (
patch(
"homeassistant.components.recorder.history.state_changes_during_period",
_fake_states,
),
freeze_time(start_time),
):
await async_setup_component(
hass,
"sensor",
@ -1221,14 +1228,6 @@ async def test_measure_sliding_window(
},
)
await hass.async_block_till_done()
with (
patch(
"homeassistant.components.recorder.history.state_changes_during_period",
_fake_states,
),
freeze_time(start_time),
):
for i in range(1, 5):
await async_update_entity(hass, f"sensor.sensor{i}")
await hass.async_block_till_done()