diff --git a/homeassistant/requirements.py b/homeassistant/requirements.py index 74469ef2fcd..a0eec0f442b 100644 --- a/homeassistant/requirements.py +++ b/homeassistant/requirements.py @@ -48,8 +48,12 @@ async def async_get_integration_with_requirements( hass, integration.domain, integration.requirements ) - for dependency in integration.dependencies: - await async_get_integration_with_requirements(hass, dependency) + deps = integration.dependencies + (integration.after_dependencies or []) + + if deps: + await asyncio.gather( + *[async_get_integration_with_requirements(hass, dep) for dep in deps] + ) return integration diff --git a/tests/test_requirements.py b/tests/test_requirements.py index 548ea645360..782b4386552 100644 --- a/tests/test_requirements.py +++ b/tests/test_requirements.py @@ -115,12 +115,19 @@ async def test_get_integration_with_requirements(hass): mock_integration( hass, MockModule("test_component_dep", requirements=["test-comp-dep==1.0.0"]) ) + mock_integration( + hass, + MockModule( + "test_component_after_dep", requirements=["test-comp-after-dep==1.0.0"] + ), + ) mock_integration( hass, MockModule( "test_component", requirements=["test-comp==1.0.0"], dependencies=["test_component_dep"], + partial_manifest={"after_dependencies": ["test_component_after_dep"]}, ), ) @@ -136,13 +143,15 @@ async def test_get_integration_with_requirements(hass): assert integration assert integration.domain == "test_component" - assert len(mock_is_installed.mock_calls) == 2 + assert len(mock_is_installed.mock_calls) == 3 assert mock_is_installed.mock_calls[0][1][0] == "test-comp==1.0.0" assert mock_is_installed.mock_calls[1][1][0] == "test-comp-dep==1.0.0" + assert mock_is_installed.mock_calls[2][1][0] == "test-comp-after-dep==1.0.0" - assert len(mock_inst.mock_calls) == 2 + assert len(mock_inst.mock_calls) == 3 assert mock_inst.mock_calls[0][1][0] == "test-comp==1.0.0" assert mock_inst.mock_calls[1][1][0] == "test-comp-dep==1.0.0" + assert mock_inst.mock_calls[2][1][0] == "test-comp-after-dep==1.0.0" async def test_install_with_wheels_index(hass):