mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Try to fix RFLink tests broken by Python 3.14.3 asyncio changes (#169157)
This commit is contained in:
@@ -87,23 +87,26 @@ 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
|
||||
failures = [True, True]
|
||||
config[CONF_RECONNECT_INTERVAL] = 60
|
||||
config = {
|
||||
**CONFIG,
|
||||
"rflink": {
|
||||
**CONFIG["rflink"],
|
||||
CONF_RECONNECT_INTERVAL: 60,
|
||||
},
|
||||
}
|
||||
failures = [False, True]
|
||||
|
||||
# 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
|
||||
|
||||
@@ -58,7 +58,7 @@ async def mock_rflink(
|
||||
# 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
|
||||
|
||||
|
||||
@@ -131,23 +131,26 @@ 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
|
||||
failures = [True, True]
|
||||
config[CONF_RECONNECT_INTERVAL] = 60
|
||||
config = {
|
||||
**CONFIG,
|
||||
"rflink": {
|
||||
**CONFIG["rflink"],
|
||||
CONF_RECONNECT_INTERVAL: 60,
|
||||
},
|
||||
}
|
||||
failures = [False, True]
|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user