mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 14:29:21 -04:00
Fix flaky ista_ecotrend statistics import test (#183685)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
dc04da4941
commit
ace0ecb60a
@@ -1,6 +1,5 @@
|
||||
"""Sensor platform for Ista EcoTrend integration."""
|
||||
|
||||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
import datetime
|
||||
from enum import StrEnum
|
||||
@@ -223,7 +222,9 @@ class IstaSensor(CoordinatorEntity[IstaCoordinator], SensorEntity):
|
||||
@override
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Handle coordinator update."""
|
||||
asyncio.run_coroutine_threadsafe(self.update_statistics(), self.hass.loop)
|
||||
self.coordinator.config_entry.async_create_task(
|
||||
self.hass, self.update_statistics()
|
||||
)
|
||||
|
||||
async def update_statistics(self) -> None:
|
||||
"""Import ista EcoTrend historical statistics."""
|
||||
|
||||
@@ -62,11 +62,11 @@ async def test_statistics_import(
|
||||
|
||||
freezer.tick(datetime.timedelta(days=1))
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
await async_wait_recording_done(hass)
|
||||
freezer.tick(datetime.timedelta(days=1))
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
await async_wait_recording_done(hass)
|
||||
|
||||
for entity in entities:
|
||||
|
||||
Reference in New Issue
Block a user