Reset esphome DomainData cache inbetween tests

This commit is contained in:
Erik 2025-05-08 09:02:46 +02:00
parent 26d48e20dd
commit 8e2011a100

View File

@ -27,7 +27,7 @@ from aioesphomeapi import (
import pytest import pytest
from zeroconf import Zeroconf from zeroconf import Zeroconf
from homeassistant.components.esphome import dashboard from homeassistant.components.esphome import dashboard, domain_data
from homeassistant.components.esphome.const import ( from homeassistant.components.esphome.const import (
CONF_ALLOW_SERVICE_CALLS, CONF_ALLOW_SERVICE_CALLS,
CONF_BLUETOOTH_MAC_ADDRESS, CONF_BLUETOOTH_MAC_ADDRESS,
@ -112,6 +112,12 @@ def mock_tts(mock_tts_cache_dir: Path) -> None:
"""Auto mock the tts cache.""" """Auto mock the tts cache."""
@pytest.fixture(autouse=True)
def reset_domain_data_cache() -> None:
"""Reset the DomainData cache."""
domain_data.DomainData.get.cache_clear()
@pytest.fixture @pytest.fixture
def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry: def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry:
"""Return the default mocked config entry.""" """Return the default mocked config entry."""