mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Do not raise repair issue about missing integration in safe mode (#123066)
This commit is contained in:
parent
3de8828358
commit
d2dd5ba0e6
@ -281,6 +281,7 @@ async def _async_setup_component(
|
||||
integration = await loader.async_get_integration(hass, domain)
|
||||
except loader.IntegrationNotFound:
|
||||
_log_error_setup_error(hass, domain, None, "Integration not found.")
|
||||
if not hass.config.safe_mode:
|
||||
ir.async_create_issue(
|
||||
hass,
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
|
@ -245,7 +245,7 @@ async def test_validate_platform_config_4(hass: HomeAssistant) -> None:
|
||||
async def test_component_not_found(
|
||||
hass: HomeAssistant, issue_registry: IssueRegistry
|
||||
) -> None:
|
||||
"""setup_component should not crash if component doesn't exist."""
|
||||
"""setup_component should raise a repair issue if component doesn't exist."""
|
||||
assert await setup.async_setup_component(hass, "non_existing", {}) is False
|
||||
assert len(issue_registry.issues) == 1
|
||||
issue = issue_registry.async_get_issue(
|
||||
@ -255,6 +255,15 @@ async def test_component_not_found(
|
||||
assert issue.translation_key == "integration_not_found"
|
||||
|
||||
|
||||
async def test_component_missing_not_raising_in_safe_mode(
|
||||
hass: HomeAssistant, issue_registry: IssueRegistry
|
||||
) -> None:
|
||||
"""setup_component should not raise an issue if component doesn't exist in safe."""
|
||||
hass.config.safe_mode = True
|
||||
assert await setup.async_setup_component(hass, "non_existing", {}) is False
|
||||
assert len(issue_registry.issues) == 0
|
||||
|
||||
|
||||
async def test_component_not_double_initialized(hass: HomeAssistant) -> None:
|
||||
"""Test we do not set up a component twice."""
|
||||
mock_setup = Mock(return_value=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user