From 9652a14f648ee614b51722373a320d6fe4d80804 Mon Sep 17 00:00:00 2001 From: Marc Billow Date: Mon, 10 Aug 2026 10:26:33 +0000 Subject: [PATCH] tests: stop the cloud write test leaving a debounced refresh behind A write schedules a debounced refresh, which polled through a fake session that only implements post(), crashed on the missing get(), and left its timer running past the end of the test. CI's lingering-timer check caught it; it passed locally only by timing luck. Stubbed the same way test_coordinator_send_command's fixture already does, which is what this test should have copied to begin with. --- tests/test_cloud_courses_flow.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_cloud_courses_flow.py b/tests/test_cloud_courses_flow.py index 1de369f..74f92ee 100644 --- a/tests/test_cloud_courses_flow.py +++ b/tests/test_cloud_courses_flow.py @@ -13,6 +13,7 @@ import asyncio import contextlib import json from typing import Any, cast +from unittest.mock import AsyncMock import cbor2 import pytest @@ -164,7 +165,14 @@ async def test_selecting_a_named_program_writes_both_tokens(hass: HomeAssistant) sent.append((path_segs, payload)) return 0x44, b"" + def pace(self): + pass + coordinator._session = cast(Any, _FakeSession()) + # Same shape as test_coordinator_send_command's fixture: a write schedules + # a debounced refresh, which would poll through this fake and leave its + # timer behind after the test. + coordinator.async_request_refresh = AsyncMock() bound = next(b for b in coordinator.bound if b.desc.key == "cycle") await coordinator.async_send_command(bound, "cloud:55")