From 23fa84e20eb4e3f890f8727ca81a77157ec9741c Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Tue, 16 Sep 2025 20:55:44 +0200 Subject: [PATCH] Verify that Ecovacs integration is setup without any errors in the tests (#152447) --- tests/components/ecovacs/conftest.py | 9 +++++++++ tests/components/ecovacs/test_init.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/components/ecovacs/conftest.py b/tests/components/ecovacs/conftest.py index 22039d6c0bc1..b33ed28c9445 100644 --- a/tests/components/ecovacs/conftest.py +++ b/tests/components/ecovacs/conftest.py @@ -1,6 +1,7 @@ """Common fixtures for the Ecovacs tests.""" from collections.abc import AsyncGenerator, Generator +import logging from typing import Any from unittest.mock import AsyncMock, Mock, patch @@ -134,6 +135,7 @@ def mock_vacbot(device_fixture: str) -> Generator[Mock]: vacbot.lifespanEvents = EventEmitter() vacbot.errorEvents = EventEmitter() vacbot.battery_status = None + vacbot.charge_status = None vacbot.fan_speed = None vacbot.components = {} yield vacbot @@ -159,6 +161,7 @@ def platforms() -> Platform | list[Platform]: @pytest.fixture async def init_integration( hass: HomeAssistant, + caplog: pytest.LogCaptureFixture, mock_config_entry: MockConfigEntry, mock_authenticator: Mock, mock_mqtt_client: Mock, @@ -177,6 +180,12 @@ async def init_integration( await hass.config_entries.async_setup(mock_config_entry.entry_id) await hass.async_block_till_done(wait_background_tasks=True) + + # No errors should be logged during setup + assert not [t for t in caplog.record_tuples if t[1] >= logging.ERROR], ( + "Errors during integration setup" + ) + yield mock_config_entry diff --git a/tests/components/ecovacs/test_init.py b/tests/components/ecovacs/test_init.py index 3115f1b4040d..5965398bd0cf 100644 --- a/tests/components/ecovacs/test_init.py +++ b/tests/components/ecovacs/test_init.py @@ -107,7 +107,7 @@ async def test_devices_in_dr( [ ("yna5x1", 26), ("5xu9h3", 25), - ("123", 2), + ("123", 3), ], ) async def test_all_entities_loaded(