From 6febe00516cc32989048bcef0a707072b56c5acf Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 1 Mar 2023 10:49:13 +0100 Subject: [PATCH] Fix lingering task in entity_platform test (#88957) * Fix lingering task in entity_platform test * Speed up the test --- tests/helpers/test_entity_platform.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/helpers/test_entity_platform.py b/tests/helpers/test_entity_platform.py index 441f47ff126..597045f557f 100644 --- a/tests/helpers/test_entity_platform.py +++ b/tests/helpers/test_entity_platform.py @@ -233,7 +233,7 @@ async def test_platform_error_slow_setup( async def setup_platform(*args): called.append(1) - await asyncio.sleep(1) + await asyncio.sleep(0.1) platform = MockPlatform(async_setup_platform=setup_platform) component = EntityComponent(_LOGGER, DOMAIN, hass) @@ -244,6 +244,9 @@ async def test_platform_error_slow_setup( assert "test_domain.test_platform" not in hass.config.components assert "test_platform is taking longer than 0 seconds" in caplog.text + # Cleanup lingering (setup_platform) task after test is done + await asyncio.sleep(0.1) + async def test_updated_state_used_for_entity_id(hass: HomeAssistant) -> None: """Test that first update results used for entity ID generation."""