Add deprecation issues for supervised and core installation methods (#145323)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Joost Lekkerkerker
2025-05-26 20:45:12 +02:00
committed by GitHub
parent b8a96d2a76
commit a2b02537a6
4 changed files with 302 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ from homeassistant import config, core as ha
from homeassistant.components.homeassistant import (
ATTR_ENTRY_ID,
ATTR_SAFE_MODE,
DOMAIN as HOMEASSISTANT_DOMAIN,
SERVICE_CHECK_CONFIG,
SERVICE_HOMEASSISTANT_RESTART,
SERVICE_HOMEASSISTANT_STOP,
@@ -32,7 +33,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError, Unauthorized
from homeassistant.helpers import entity, entity_registry as er
from homeassistant.helpers import entity, entity_registry as er, issue_registry as ir
from homeassistant.setup import async_setup_component
from tests.common import (
@@ -637,3 +638,187 @@ async def test_reload_all(
assert len(core_config) == 1
assert len(themes) == 1
assert len(jinja) == 1
@pytest.mark.parametrize(
"installation_type",
[
"Home Assistant Core",
"Home Assistant Supervised",
],
)
@pytest.mark.parametrize(
"arch",
[
"i386",
"armhf",
"armv7",
],
)
async def test_deprecated_installation_issue_32bit_method(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
installation_type: str,
arch: str,
) -> None:
"""Test deprecated installation issue."""
with patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": installation_type,
"arch": arch,
},
):
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
await hass.async_block_till_done()
assert len(issue_registry.issues) == 1
issue = issue_registry.async_get_issue(
HOMEASSISTANT_DOMAIN, "deprecated_method_architecture"
)
assert issue.domain == HOMEASSISTANT_DOMAIN
assert issue.severity == ir.IssueSeverity.WARNING
assert issue.translation_placeholders == {
"installation_type": installation_type[15:],
"arch": arch,
}
@pytest.mark.parametrize(
"installation_type",
[
"Home Assistant Container",
"Home Assistant OS",
],
)
@pytest.mark.parametrize(
"arch",
[
"i386",
"armhf",
],
)
async def test_deprecated_installation_issue_32bit(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
installation_type: str,
arch: str,
) -> None:
"""Test deprecated installation issue."""
with patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": installation_type,
"arch": arch,
},
):
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
await hass.async_block_till_done()
assert len(issue_registry.issues) == 1
issue = issue_registry.async_get_issue(
HOMEASSISTANT_DOMAIN, "deprecated_architecture"
)
assert issue.domain == HOMEASSISTANT_DOMAIN
assert issue.severity == ir.IssueSeverity.WARNING
assert issue.translation_placeholders == {
"installation_type": installation_type[15:],
"arch": arch,
}
@pytest.mark.parametrize(
"installation_type",
[
"Home Assistant Core",
"Home Assistant Supervised",
],
)
async def test_deprecated_installation_issue_method(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
installation_type: str,
) -> None:
"""Test deprecated installation issue."""
with patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": installation_type,
"arch": "generic-x86-64",
},
):
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
await hass.async_block_till_done()
assert len(issue_registry.issues) == 1
issue = issue_registry.async_get_issue(HOMEASSISTANT_DOMAIN, "deprecated_method")
assert issue.domain == HOMEASSISTANT_DOMAIN
assert issue.severity == ir.IssueSeverity.WARNING
assert issue.translation_placeholders == {
"installation_type": installation_type[15:],
"arch": "generic-x86-64",
}
@pytest.mark.parametrize(
("board", "issue_id"),
[
("rpi3", "deprecated_os_aarch64"),
("rpi4", "deprecated_os_aarch64"),
("tinker", "deprecated_os_armv7"),
("odroid-xu4", "deprecated_os_armv7"),
("rpi2", "deprecated_os_armv7"),
],
)
async def test_deprecated_installation_issue_aarch64(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
board: str,
issue_id: str,
) -> None:
"""Test deprecated installation issue."""
with (
patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": "Home Assistant OS",
"arch": "armv7",
},
),
patch(
"homeassistant.components.hassio.get_os_info", return_value={"board": board}
),
):
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
await hass.async_block_till_done()
assert len(issue_registry.issues) == 1
issue = issue_registry.async_get_issue(HOMEASSISTANT_DOMAIN, issue_id)
assert issue.domain == HOMEASSISTANT_DOMAIN
assert issue.severity == ir.IssueSeverity.WARNING
assert issue.translation_placeholders == {
"installation_guide": "https://www.home-assistant.io/installation/",
}
async def test_deprecated_installation_issue_armv7_container(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test deprecated installation issue."""
with patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": "Home Assistant Container",
"arch": "armv7",
},
):
assert await async_setup_component(hass, HOMEASSISTANT_DOMAIN, {})
await hass.async_block_till_done()
assert len(issue_registry.issues) == 1
issue = issue_registry.async_get_issue(
HOMEASSISTANT_DOMAIN, "deprecated_container_armv7"
)
assert issue.domain == HOMEASSISTANT_DOMAIN
assert issue.severity == ir.IssueSeverity.WARNING