From b5bb4183ab46f4592c41c65646463b404a790642 Mon Sep 17 00:00:00 2001 From: javicalle <31999997+javicalle@users.noreply.github.com> Date: Sat, 25 Apr 2026 19:49:49 +0200 Subject: [PATCH 1/5] Fix `entity_availability` tests Fixes connections failures management in tests --- tests/components/rflink/test_init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/components/rflink/test_init.py b/tests/components/rflink/test_init.py index 736ad4c73cf1db..100ed07adf9cce 100644 --- a/tests/components/rflink/test_init.py +++ b/tests/components/rflink/test_init.py @@ -58,7 +58,7 @@ async def create_rflink_connection(*args, **kwargs): # failures can be a list of booleans indicating in which sequence # creating a connection should success or fail if failures: - fail = failures.pop() + fail = failures.pop(0) # removes from left to right else: fail = False From f493dc30bdee93ebba4c26bacf125d5d1ba11809 Mon Sep 17 00:00:00 2001 From: javicalle <31999997+javicalle@users.noreply.github.com> Date: Sat, 25 Apr 2026 19:55:36 +0200 Subject: [PATCH 2/5] Fix `entity_availability` tests --- tests/components/rflink/test_binary_sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/components/rflink/test_binary_sensor.py b/tests/components/rflink/test_binary_sensor.py index 6b8ce286fd9a88..d880bd64e1ba2f 100644 --- a/tests/components/rflink/test_binary_sensor.py +++ b/tests/components/rflink/test_binary_sensor.py @@ -97,13 +97,14 @@ async def test_entity_availability( # Make sure Rflink mock does not 'recover' to quickly from the # disconnect or else the unavailability cannot be measured config = CONFIG - failures = [True, True] + failures = [False, True] config[CONF_RECONNECT_INTERVAL] = 60 # Create platform and entities event_callback, _, _, disconnect_callback = await mock_rflink( hass, config, DOMAIN, monkeypatch, failures=failures ) + await hass.async_block_till_done() # Entities are unknown by default assert hass.states.get("binary_sensor.test").state == STATE_UNKNOWN From beb28528c5f4e4e0da4c06471946862093dafb2c Mon Sep 17 00:00:00 2001 From: javicalle <31999997+javicalle@users.noreply.github.com> Date: Sat, 25 Apr 2026 19:56:26 +0200 Subject: [PATCH 3/5] Fix `entity_availability` tests --- tests/components/rflink/test_sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/components/rflink/test_sensor.py b/tests/components/rflink/test_sensor.py index 96204043298ff9..c5eea426381191 100644 --- a/tests/components/rflink/test_sensor.py +++ b/tests/components/rflink/test_sensor.py @@ -141,13 +141,14 @@ async def test_entity_availability( # Make sure Rflink mock does not 'recover' to quickly from the # disconnect or else the unavailability cannot be measured config = CONFIG - failures = [True, True] + failures = [False, True] config[CONF_RECONNECT_INTERVAL] = 60 # Create platform and entities _, _, _, disconnect_callback = await mock_rflink( hass, config, DOMAIN, monkeypatch, failures=failures ) + await hass.async_block_till_done() # Entities are available by default assert hass.states.get("sensor.test").state == STATE_UNKNOWN From 3be398a7a5446a59fd1603c2fbaa6dc027889668 Mon Sep 17 00:00:00 2001 From: javicalle <31999997+javicalle@users.noreply.github.com> Date: Sat, 25 Apr 2026 20:26:45 +0200 Subject: [PATCH 4/5] Update test_binary_sensor.py Remove the `xfail` marker and avoid mutating the shared `CONFIG` --- tests/components/rflink/test_binary_sensor.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/components/rflink/test_binary_sensor.py b/tests/components/rflink/test_binary_sensor.py index d880bd64e1ba2f..6bce2f6cab25d9 100644 --- a/tests/components/rflink/test_binary_sensor.py +++ b/tests/components/rflink/test_binary_sensor.py @@ -87,18 +87,20 @@ async def test_default_setup( assert hass.states.get("binary_sensor.test").state == STATE_OFF -@pytest.mark.xfail( - reason="Flaky due to Python 3.14.3 asyncio changes - see home-assistant/core#162263" -) async def test_entity_availability( hass: HomeAssistant, monkeypatch: pytest.MonkeyPatch ) -> None: """If Rflink device is disconnected, entities should become unavailable.""" # Make sure Rflink mock does not 'recover' to quickly from the # disconnect or else the unavailability cannot be measured - config = CONFIG + config = { + **CONFIG, + "rflink": { + **CONFIG["rflink"], + CONF_RECONNECT_INTERVAL: 60, + }, + } failures = [False, True] - config[CONF_RECONNECT_INTERVAL] = 60 # Create platform and entities event_callback, _, _, disconnect_callback = await mock_rflink( From 60cd4a999116b3967215481eab5fb1f1fa40d037 Mon Sep 17 00:00:00 2001 From: javicalle <31999997+javicalle@users.noreply.github.com> Date: Sat, 25 Apr 2026 20:26:49 +0200 Subject: [PATCH 5/5] Update test_sensor.py Remove the `xfail` marker and avoid mutating the shared `CONFIG` --- tests/components/rflink/test_sensor.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/components/rflink/test_sensor.py b/tests/components/rflink/test_sensor.py index c5eea426381191..05655cd52ae413 100644 --- a/tests/components/rflink/test_sensor.py +++ b/tests/components/rflink/test_sensor.py @@ -131,18 +131,20 @@ async def test_disable_automatic_add( assert not hass.states.get("sensor.test2") -@pytest.mark.xfail( - reason="Flaky due to Python 3.14.3 asyncio changes - see home-assistant/core#162263" -) async def test_entity_availability( hass: HomeAssistant, monkeypatch: pytest.MonkeyPatch ) -> None: """If Rflink device is disconnected, entities should become unavailable.""" # Make sure Rflink mock does not 'recover' to quickly from the # disconnect or else the unavailability cannot be measured - config = CONFIG + config = { + **CONFIG, + "rflink": { + **CONFIG["rflink"], + CONF_RECONNECT_INTERVAL: 60, + }, + } failures = [False, True] - config[CONF_RECONNECT_INTERVAL] = 60 # Create platform and entities _, _, _, disconnect_callback = await mock_rflink(