Fix check config (#28393)
This commit is contained in:
parent
70c4b4a4f0
commit
631a819bd1
2 changed files with 28 additions and 5 deletions
|
@ -35,13 +35,21 @@ async def async_get_integration_with_requirements(
|
||||||
This can raise IntegrationNotFound if manifest or integration
|
This can raise IntegrationNotFound if manifest or integration
|
||||||
is invalid, RequirementNotFound if there was some type of
|
is invalid, RequirementNotFound if there was some type of
|
||||||
failure to install requirements.
|
failure to install requirements.
|
||||||
|
|
||||||
|
Does not handle circular dependencies.
|
||||||
"""
|
"""
|
||||||
integration = await async_get_integration(hass, domain)
|
integration = await async_get_integration(hass, domain)
|
||||||
|
|
||||||
if hass.config.skip_pip or not integration.requirements:
|
if hass.config.skip_pip:
|
||||||
return integration
|
return integration
|
||||||
|
|
||||||
await async_process_requirements(hass, integration.domain, integration.requirements)
|
if integration.requirements:
|
||||||
|
await async_process_requirements(
|
||||||
|
hass, integration.domain, integration.requirements
|
||||||
|
)
|
||||||
|
|
||||||
|
for dependency in integration.dependencies:
|
||||||
|
await async_get_integration_with_requirements(hass, dependency)
|
||||||
|
|
||||||
return integration
|
return integration
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,17 @@ async def test_install_missing_package(hass):
|
||||||
async def test_get_integration_with_requirements(hass):
|
async def test_get_integration_with_requirements(hass):
|
||||||
"""Check getting an integration with loaded requirements."""
|
"""Check getting an integration with loaded requirements."""
|
||||||
hass.config.skip_pip = False
|
hass.config.skip_pip = False
|
||||||
mock_integration(hass, MockModule("test_component", requirements=["hello==1.0.0"]))
|
mock_integration(
|
||||||
|
hass, MockModule("test_component_dep", requirements=["test-comp-dep==1.0.0"])
|
||||||
|
)
|
||||||
|
mock_integration(
|
||||||
|
hass,
|
||||||
|
MockModule(
|
||||||
|
"test_component",
|
||||||
|
requirements=["test-comp==1.0.0"],
|
||||||
|
dependencies=["test_component_dep"],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.util.package.is_installed", return_value=False
|
"homeassistant.util.package.is_installed", return_value=False
|
||||||
|
@ -126,8 +136,13 @@ async def test_get_integration_with_requirements(hass):
|
||||||
assert integration
|
assert integration
|
||||||
assert integration.domain == "test_component"
|
assert integration.domain == "test_component"
|
||||||
|
|
||||||
assert len(mock_is_installed.mock_calls) == 1
|
assert len(mock_is_installed.mock_calls) == 2
|
||||||
assert len(mock_inst.mock_calls) == 1
|
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 len(mock_inst.mock_calls) == 2
|
||||||
|
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"
|
||||||
|
|
||||||
|
|
||||||
async def test_install_with_wheels_index(hass):
|
async def test_install_with_wheels_index(hass):
|
||||||
|
|
Loading…
Add table
Reference in a new issue