From b9fb4469d853c46ee8aabeb3e43ecc38d9043d7a Mon Sep 17 00:00:00 2001 From: G Johansson Date: Sun, 9 Nov 2025 20:16:56 +0100 Subject: [PATCH] Remove deprecated start of flow no link to config entry (#155956) Co-authored-by: Franck Nijhof Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- homeassistant/config_entries.py | 6 ++---- tests/test_config_entries.py | 25 +++++++++++-------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 105958bd712..9e7323d390a 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -1418,10 +1418,8 @@ class ConfigEntriesFlowManager( SOURCE_REAUTH, SOURCE_RECONFIGURE, } and "entry_id" not in context: - # Deprecated in 2024.12, should fail in 2025.12 - report_usage( - f"initialises a {source} flow without a link to the config entry", - breaks_in_ha_version="2025.12", + raise HomeAssistantError( + f"Cannot initialize a {source} flow without a link to the config entry" ) flow_id = ulid_util.ulid_now() diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index 8eb166489cd..bb4765d9ed5 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -5983,9 +5983,8 @@ async def test_reauth_reconfigure_missing_entry( await hass.async_block_till_done() with pytest.raises( - RuntimeError, - match=f"Detected code that initialises a {source} flow without a link " - "to the config entry. Please report this issue", + HomeAssistantError, + match=f"Cannot initialize a {source} flow without a link to the config entry", ): await manager.flow.async_init("test", context={"source": source}) await hass.async_block_till_done() @@ -6002,7 +6001,6 @@ async def test_reauth_reconfigure_missing_entry_component( hass: HomeAssistant, manager: config_entries.ConfigEntries, source: str, - caplog: pytest.LogCaptureFixture, ) -> None: """Test the async_reauth_helper.""" entry = MockConfigEntry(title="test_title", domain="test") @@ -6015,19 +6013,18 @@ async def test_reauth_reconfigure_missing_entry_component( await manager.async_setup(entry.entry_id) await hass.async_block_till_done() - with patch.object(frame, "_REPORTED_INTEGRATIONS", set()): + with ( + patch.object(frame, "_REPORTED_INTEGRATIONS", set()), + pytest.raises( + HomeAssistantError, + match=f"Cannot initialize a {source} flow without a link to the config entry", + ), + ): await manager.flow.async_init("test", context={"source": source}) - await hass.async_block_till_done() - # Flow still created, but deprecation logged + # Flow is not created flows = hass.config_entries.flow.async_progress() - assert len(flows) == 1 - assert flows[0]["context"]["source"] == source - - assert ( - f"Detected that integration 'hue' initialises a {source} flow" - " without a link to the config entry at homeassistant/components" in caplog.text - ) + assert len(flows) == 0 async def test_reconfigure(