1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

Fix flaky test_api_conditional_memory and improve integration test patterns (#9379)

This commit is contained in:
J. Nick Koston
2025-07-07 18:08:21 -05:00
committed by GitHub
parent 7150f2806f
commit a72905191a
11 changed files with 341 additions and 234 deletions

View File

@@ -7,6 +7,7 @@ including RGB, color temperature, effects, transitions, and flash.
import asyncio
from typing import Any
from aioesphomeapi import LightState
import pytest
from .types import APIClientConnectedFactory, RunCompiledFunction
@@ -76,7 +77,7 @@ async def test_light_calls(
client.light_command(key=rgbcw_light.key, white=0.6)
state = await wait_for_state_change(rgbcw_light.key)
# White might need more tolerance or might not be directly settable
if hasattr(state, "white"):
if isinstance(state, LightState) and state.white is not None:
assert state.white == pytest.approx(0.6, abs=0.1)
# Test 8: color_temperature only