Stub finding custom integrations in tests (#43692)
parent
897ff31ffe
commit
ea55051161
|
@ -195,6 +195,8 @@ async def async_test_home_assistant(loop):
|
|||
hass.async_add_executor_job = async_add_executor_job
|
||||
hass.async_create_task = async_create_task
|
||||
|
||||
hass.data[loader.DATA_CUSTOM_COMPONENTS] = {}
|
||||
|
||||
hass.config.location_name = "test home"
|
||||
hass.config.config_dir = get_test_config_dir()
|
||||
hass.config.latitude = 32.87336
|
||||
|
|
|
@ -537,3 +537,9 @@ def legacy_patchable_time():
|
|||
async_track_utc_time_change,
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def enable_custom_integrations(hass):
|
||||
"""Enable custom integrations defined in the test dir."""
|
||||
hass.data.pop(loader.DATA_CUSTOM_COMPONENTS)
|
||||
|
|
|
@ -149,7 +149,7 @@ async def test_get_integration_legacy(hass):
|
|||
assert integration.get_platform("switch") is not None
|
||||
|
||||
|
||||
async def test_get_integration_custom_component(hass):
|
||||
async def test_get_integration_custom_component(hass, enable_custom_integrations):
|
||||
"""Test resolving integration."""
|
||||
integration = await loader.async_get_integration(hass, "test_package")
|
||||
print(integration)
|
||||
|
@ -293,7 +293,7 @@ def _get_test_integration_with_zeroconf_matcher(hass, name, config_flow):
|
|||
)
|
||||
|
||||
|
||||
async def test_get_custom_components(hass):
|
||||
async def test_get_custom_components(hass, enable_custom_integrations):
|
||||
"""Verify that custom components are cached."""
|
||||
test_1_integration = _get_test_integration(hass, "test_1", False)
|
||||
test_2_integration = _get_test_integration(hass, "test_2", True)
|
||||
|
|
Loading…
Reference in New Issue