Only raise missing integration issue for config entry integrations (#126654)
This commit is contained in:
parent
ffa76dfd24
commit
c1781cd793
3 changed files with 25 additions and 6 deletions
|
@ -281,7 +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:
|
||||
if not hass.config.safe_mode and hass.config_entries.async_entries(domain):
|
||||
ir.async_create_issue(
|
||||
hass,
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
|
|
|
@ -23,6 +23,7 @@ async def test_integration_not_found_confirm_step(
|
|||
await hass.async_block_till_done()
|
||||
assert await async_setup_component(hass, REPAIRS_DOMAIN, {REPAIRS_DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
MockConfigEntry(domain="test1").add_to_hass(hass)
|
||||
assert await async_setup_component(hass, "test1", {}) is False
|
||||
await hass.async_block_till_done()
|
||||
entry1 = MockConfigEntry(domain="test1")
|
||||
|
@ -83,6 +84,7 @@ async def test_integration_not_found_ignore_step(
|
|||
await hass.async_block_till_done()
|
||||
assert await async_setup_component(hass, REPAIRS_DOMAIN, {REPAIRS_DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
MockConfigEntry(domain="test1").add_to_hass(hass)
|
||||
assert await async_setup_component(hass, "test1", {}) is False
|
||||
await hass.async_block_till_done()
|
||||
entry1 = MockConfigEntry(domain="test1")
|
||||
|
|
|
@ -248,22 +248,39 @@ async def test_component_not_found(
|
|||
hass: HomeAssistant, issue_registry: IssueRegistry
|
||||
) -> None:
|
||||
"""setup_component should raise a repair issue if component doesn't exist."""
|
||||
MockConfigEntry(domain="non_existing").add_to_hass(hass)
|
||||
assert await setup.async_setup_component(hass, "non_existing", {}) is False
|
||||
assert len(issue_registry.issues) == 1
|
||||
issue = issue_registry.async_get_issue(
|
||||
HOMEASSISTANT_DOMAIN, "integration_not_found.non_existing"
|
||||
)
|
||||
assert issue
|
||||
assert issue.translation_key == "integration_not_found"
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
"integration_not_found.non_existing",
|
||||
) in issue_registry.issues
|
||||
|
||||
|
||||
async def test_yaml_component_not_found(
|
||||
hass: HomeAssistant, issue_registry: IssueRegistry
|
||||
) -> None:
|
||||
"""setup_component should only raise an exception for missing config entry integrations."""
|
||||
assert await setup.async_setup_component(hass, "non_existing", {}) is False
|
||||
assert len(issue_registry.issues) == 0
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
"integration_not_found.non_existing",
|
||||
) not in issue_registry.issues
|
||||
|
||||
|
||||
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."""
|
||||
MockConfigEntry(domain="non_existing").add_to_hass(hass)
|
||||
hass.config.safe_mode = True
|
||||
assert await setup.async_setup_component(hass, "non_existing", {}) is False
|
||||
assert len(issue_registry.issues) == 0
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
"integration_not_found.non_existing",
|
||||
) not in issue_registry.issues
|
||||
|
||||
|
||||
async def test_component_not_double_initialized(hass: HomeAssistant) -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue