From 33c2cb989529352da840e8ffce21d93acd7f79f1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 24 May 2023 15:24:15 -0500 Subject: [PATCH] Fix integration trapezoidal test (#93494) --- tests/components/integration/test_sensor.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/components/integration/test_sensor.py b/tests/components/integration/test_sensor.py index 7bbeeeb3e43..515ae990deb 100644 --- a/tests/components/integration/test_sensor.py +++ b/tests/components/integration/test_sensor.py @@ -217,10 +217,11 @@ async def test_trapezoidal(hass: HomeAssistant) -> None: hass.states.async_set(entity_id, 0, {}) await hass.async_block_till_done() - # Testing a power sensor with non-monotonic intervals and values - for time, value in [(20, 10), (30, 30), (40, 5), (50, 0)]: - now = dt_util.utcnow() + timedelta(minutes=time) - with freeze_time(now): + start_time = dt_util.utcnow() + with freeze_time(start_time) as freezer: + # Testing a power sensor with non-monotonic intervals and values + for time, value in [(20, 10), (30, 30), (40, 5), (50, 0)]: + freezer.move_to(start_time + timedelta(minutes=time)) hass.states.async_set( entity_id, value,