Fix Requirement parsing in RequirementsManager (#160485)

This commit is contained in:
epenet
2026-01-12 10:55:39 +01:00
committed by GitHub
parent 0da518e951
commit 6eccbfc1cf
3 changed files with 62 additions and 30 deletions
+15 -4
View File
@@ -661,11 +661,12 @@ async def test_discovery_requirements_dhcp(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("requirement", "is_built_in", "deprecation_info"),
("requirement", "is_built_in", "deprecation_prefix", "deprecation_info"),
[
(
"hello",
True,
"Detected that integration",
"which is deprecated for testing. This will stop working in Home Assistant"
" 2020.12, please create a bug report at https://github.com/home-assistant/"
"core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+test_component%22",
@@ -673,6 +674,7 @@ async def test_discovery_requirements_dhcp(hass: HomeAssistant) -> None:
(
"hello>=1.0.0",
False,
"Detected that custom integration",
"which is deprecated for testing. This will stop working in Home Assistant"
" 2020.12, please create a bug report at https://github.com/home-assistant/"
"core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+test_component%22",
@@ -680,6 +682,7 @@ async def test_discovery_requirements_dhcp(hass: HomeAssistant) -> None:
(
"pyserial-asyncio",
False,
"Detected that custom integration",
"which should be replaced by pyserial-asyncio-fast. This will stop"
" working in Home Assistant 2026.7, please create a bug report at "
"https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+"
@@ -688,6 +691,7 @@ async def test_discovery_requirements_dhcp(hass: HomeAssistant) -> None:
(
"pyserial-asyncio>=0.6",
True,
"Detected that integration",
"which should be replaced by pyserial-asyncio-fast. This will stop"
" working in Home Assistant 2026.7, please create a bug report at "
"https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+"
@@ -699,6 +703,7 @@ async def test_install_deprecated_package(
hass: HomeAssistant,
requirement: str,
is_built_in: bool,
deprecation_prefix: str,
deprecation_info: str,
caplog: pytest.LogCaptureFixture,
) -> None:
@@ -710,10 +715,16 @@ async def test_install_deprecated_package(
patch("homeassistant.util.package.install_package", return_value=True),
):
await async_process_requirements(
hass, "test_component", [requirement], is_built_in
hass,
"test_component",
[
requirement,
"git+https://github.com/user/project.git@1.2.3",
],
is_built_in,
)
assert (
f"Detected that {'' if is_built_in else 'custom '}integration "
f"'test_component' has requirement '{requirement}' {deprecation_info}"
f"{deprecation_prefix} 'test_component'"
f" has requirement '{requirement}' {deprecation_info}"
) in caplog.text