mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 02:38:10 +02:00
Provide api to see which integrations are being loaded (#48274)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
"""Test component/platform setup."""
|
||||
# pylint: disable=protected-access
|
||||
import asyncio
|
||||
import datetime
|
||||
import os
|
||||
import threading
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
@ -644,3 +645,31 @@ async def test_integration_only_setup_entry(hass):
|
||||
),
|
||||
)
|
||||
assert await setup.async_setup_component(hass, "test_integration_only_entry", {})
|
||||
|
||||
|
||||
async def test_async_start_setup(hass):
|
||||
"""Test setup started context manager keeps track of setup times."""
|
||||
with setup.async_start_setup(hass, ["august"]):
|
||||
assert isinstance(
|
||||
hass.data[setup.DATA_SETUP_STARTED]["august"], datetime.datetime
|
||||
)
|
||||
with setup.async_start_setup(hass, ["august"]):
|
||||
assert isinstance(
|
||||
hass.data[setup.DATA_SETUP_STARTED]["august_2"], datetime.datetime
|
||||
)
|
||||
|
||||
assert "august" not in hass.data[setup.DATA_SETUP_STARTED]
|
||||
assert isinstance(hass.data[setup.DATA_SETUP_TIME]["august"], datetime.timedelta)
|
||||
assert "august_2" not in hass.data[setup.DATA_SETUP_TIME]
|
||||
|
||||
|
||||
async def test_async_start_setup_platforms(hass):
|
||||
"""Test setup started context manager keeps track of setup times for platforms."""
|
||||
with setup.async_start_setup(hass, ["sensor.august"]):
|
||||
assert isinstance(
|
||||
hass.data[setup.DATA_SETUP_STARTED]["sensor.august"], datetime.datetime
|
||||
)
|
||||
|
||||
assert "august" not in hass.data[setup.DATA_SETUP_STARTED]
|
||||
assert isinstance(hass.data[setup.DATA_SETUP_TIME]["august"], datetime.timedelta)
|
||||
assert "sensor" not in hass.data[setup.DATA_SETUP_TIME]
|
||||
|
Reference in New Issue
Block a user