From 6ba8b7a5d6f0cf39d0f77e9dc748259a0d68d240 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 7 Jun 2024 02:21:53 -0500 Subject: [PATCH] Remove isal from after_dependencies in http (#119000) --- homeassistant/bootstrap.py | 13 ++++++++++--- homeassistant/components/http/manifest.json | 1 - tests/test_circular_imports.py | 4 ++-- tests/test_requirements.py | 9 ++++----- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 391c6ebfa45..74196cdc625 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -134,8 +134,15 @@ COOLDOWN_TIME = 60 DEBUGGER_INTEGRATIONS = {"debugpy"} + +# Core integrations are unconditionally loaded CORE_INTEGRATIONS = {"homeassistant", "persistent_notification"} -LOGGING_INTEGRATIONS = { + +# Integrations that are loaded right after the core is set up +LOGGING_AND_HTTP_DEPS_INTEGRATIONS = { + # isal is loaded right away before `http` to ensure if its + # enabled, that `isal` is up to date. + "isal", # Set log levels "logger", # Error logging @@ -214,8 +221,8 @@ CRITICAL_INTEGRATIONS = { } SETUP_ORDER = ( - # Load logging as soon as possible - ("logging", LOGGING_INTEGRATIONS), + # Load logging and http deps as soon as possible + ("logging, http deps", LOGGING_AND_HTTP_DEPS_INTEGRATIONS), # Setup frontend and recorder ("frontend, recorder", {*FRONTEND_INTEGRATIONS, *RECORDER_INTEGRATIONS}), # Start up debuggers. Start these first in case they want to wait. diff --git a/homeassistant/components/http/manifest.json b/homeassistant/components/http/manifest.json index b48a188cf47..fb804251edc 100644 --- a/homeassistant/components/http/manifest.json +++ b/homeassistant/components/http/manifest.json @@ -1,7 +1,6 @@ { "domain": "http", "name": "HTTP", - "after_dependencies": ["isal"], "codeowners": ["@home-assistant/core"], "documentation": "https://www.home-assistant.io/integrations/http", "integration_type": "system", diff --git a/tests/test_circular_imports.py b/tests/test_circular_imports.py index 79f0fd9caf7..dfdee65b2b0 100644 --- a/tests/test_circular_imports.py +++ b/tests/test_circular_imports.py @@ -10,7 +10,7 @@ from homeassistant.bootstrap import ( DEBUGGER_INTEGRATIONS, DEFAULT_INTEGRATIONS, FRONTEND_INTEGRATIONS, - LOGGING_INTEGRATIONS, + LOGGING_AND_HTTP_DEPS_INTEGRATIONS, RECORDER_INTEGRATIONS, STAGE_1_INTEGRATIONS, ) @@ -23,7 +23,7 @@ from homeassistant.bootstrap import ( { *DEBUGGER_INTEGRATIONS, *CORE_INTEGRATIONS, - *LOGGING_INTEGRATIONS, + *LOGGING_AND_HTTP_DEPS_INTEGRATIONS, *FRONTEND_INTEGRATIONS, *RECORDER_INTEGRATIONS, *STAGE_1_INTEGRATIONS, diff --git a/tests/test_requirements.py b/tests/test_requirements.py index 2b2415e22a8..73f3f54c3c4 100644 --- a/tests/test_requirements.py +++ b/tests/test_requirements.py @@ -591,7 +591,7 @@ async def test_discovery_requirements_mqtt(hass: HomeAssistant) -> None: ) as mock_process: await async_get_integration_with_requirements(hass, "mqtt_comp") - assert len(mock_process.mock_calls) == 2 + assert len(mock_process.mock_calls) == 1 assert mock_process.mock_calls[0][1][1] == mqtt.requirements @@ -608,13 +608,12 @@ async def test_discovery_requirements_ssdp(hass: HomeAssistant) -> None: ) as mock_process: await async_get_integration_with_requirements(hass, "ssdp_comp") - assert len(mock_process.mock_calls) == 4 + assert len(mock_process.mock_calls) == 3 assert mock_process.mock_calls[0][1][1] == ssdp.requirements assert { mock_process.mock_calls[1][1][0], mock_process.mock_calls[2][1][0], - mock_process.mock_calls[3][1][0], - } == {"network", "recorder", "isal"} + } == {"network", "recorder"} @pytest.mark.parametrize( @@ -638,7 +637,7 @@ async def test_discovery_requirements_zeroconf( ) as mock_process: await async_get_integration_with_requirements(hass, "comp") - assert len(mock_process.mock_calls) == 4 + assert len(mock_process.mock_calls) == 3 assert mock_process.mock_calls[0][1][1] == zeroconf.requirements