Also install after_deps (#28453)

pull/28456/head
Paulus Schoutsen 2019-11-01 17:21:50 -07:00
parent fc7d43269c
commit 3f8dc5ed75
2 changed files with 17 additions and 4 deletions

View File

@ -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

View File

@ -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):