Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions homeassistant/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,21 @@ async def async_get_integration_with_requirements(
deps_to_check.append(check_domain)

if deps_to_check:
await asyncio.gather(
results = await asyncio.gather(
*[
async_get_integration_with_requirements(hass, dep, done)
for dep in deps_to_check
]
],
return_exceptions=True,
)
for result in results:
if not isinstance(result, BaseException):
continue
if (
not isinstance(result, IntegrationNotFound)
or result.domain not in integration.after_dependencies
):
raise result

cache[domain] = integration
event.set()
Expand Down
34 changes: 34 additions & 0 deletions tests/test_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,40 @@ async def test_get_integration_with_requirements(hass):
]


async def test_get_integration_with_missing_dependencies(hass):
"""Check getting an integration with missing dependencies."""
hass.config.skip_pip = False
mock_integration(
hass,
MockModule("test_component_after_dep"),
)
mock_integration(
hass,
MockModule(
"test_component",
dependencies=["test_component_dep"],
partial_manifest={"after_dependencies": ["test_component_after_dep"]},
),
)
with pytest.raises(loader.IntegrationNotFound):
await async_get_integration_with_requirements(hass, "test_component")


async def test_get_integration_with_missing_after_dependencies(hass):
"""Check getting an integration with missing after_dependencies."""
hass.config.skip_pip = False
mock_integration(
hass,
MockModule(
"test_component",
partial_manifest={"after_dependencies": ["test_component_after_dep"]},
),
)
integration = await async_get_integration_with_requirements(hass, "test_component")
assert integration
assert integration.domain == "test_component"


async def test_install_with_wheels_index(hass):
"""Test an install attempt with wheels index URL."""
hass.config.skip_pip = False
Expand Down