mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Update nest tests to unload config entries to perform clean teardown (#130266)
This commit is contained in:
parent
ecd8dde347
commit
73a62a09b0
@ -107,6 +107,7 @@ class FakeSubscriber(GoogleNestSubscriber):
|
|||||||
def __init__(self) -> None: # pylint: disable=super-init-not-called
|
def __init__(self) -> None: # pylint: disable=super-init-not-called
|
||||||
"""Initialize Fake Subscriber."""
|
"""Initialize Fake Subscriber."""
|
||||||
self._device_manager = DeviceManager()
|
self._device_manager = DeviceManager()
|
||||||
|
self._subscriber_name = "fake-name"
|
||||||
|
|
||||||
def set_update_callback(self, target: Callable[[EventMessage], Awaitable[None]]):
|
def set_update_callback(self, target: Callable[[EventMessage], Awaitable[None]]):
|
||||||
"""Capture the callback set by Home Assistant."""
|
"""Capture the callback set by Home Assistant."""
|
||||||
|
@ -22,6 +22,7 @@ from homeassistant.components.application_credentials import (
|
|||||||
)
|
)
|
||||||
from homeassistant.components.nest import DOMAIN
|
from homeassistant.components.nest import DOMAIN
|
||||||
from homeassistant.components.nest.const import CONF_SUBSCRIBER_ID, SDM_SCOPES
|
from homeassistant.components.nest.const import CONF_SUBSCRIBER_ID, SDM_SCOPES
|
||||||
|
from homeassistant.config_entries import ConfigEntryState
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
@ -287,6 +288,8 @@ async def setup_base_platform(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
yield _setup_func
|
yield _setup_func
|
||||||
|
if config_entry and config_entry.state == ConfigEntryState.LOADED:
|
||||||
|
await hass.config_entries.async_unload(config_entry.entry_id)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user