1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-08 17:49:37 +01:00

Fix flaky dsmr tests broken by Python 3.14.3 asyncio changes (#169431)

This commit is contained in:
epenet
2026-04-30 20:33:43 +02:00
committed by GitHub
parent 27c76f130e
commit 9224856919
3 changed files with 8 additions and 7 deletions
+8
View File
@@ -25,6 +25,9 @@ def dsmr_connection_fixture() -> Generator[tuple[MagicMock, MagicMock, MagicMock
transport = MagicMock(spec=asyncio.Transport)
protocol = MagicMock(spec=DSMRProtocol)
closed = asyncio.Event()
protocol.wait_closed = closed.wait
async def connection_factory(*args, **kwargs):
"""Return mocked out Asyncio classes."""
return (transport, protocol)
@@ -42,6 +45,7 @@ def dsmr_connection_fixture() -> Generator[tuple[MagicMock, MagicMock, MagicMock
),
):
yield (connection_factory, transport, protocol)
closed.set()
@pytest.fixture
@@ -53,6 +57,9 @@ def rfxtrx_dsmr_connection_fixture() -> Generator[
transport = MagicMock(spec=asyncio.Transport)
protocol = MagicMock(spec=RFXtrxDSMRProtocol)
closed = asyncio.Event()
protocol.wait_closed = closed.wait
async def connection_factory(*args, **kwargs):
"""Return mocked out Asyncio classes."""
return (transport, protocol)
@@ -70,6 +77,7 @@ def rfxtrx_dsmr_connection_fixture() -> Generator[
),
):
yield (connection_factory, transport, protocol)
closed.set()
@pytest.fixture
@@ -10,7 +10,6 @@ from dsmr_parser.obis_references import (
GAS_METER_READING,
)
from dsmr_parser.objects import CosemObject, MBusObject, Telegram
import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.core import HomeAssistant
@@ -20,9 +19,6 @@ from tests.components.diagnostics import get_diagnostics_for_config_entry
from tests.typing import ClientSessionGenerator
@pytest.mark.xfail(
reason="Flaky due to Python 3.14.3 asyncio changes - see home-assistant/core#162263"
)
async def test_diagnostics(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
-3
View File
@@ -51,9 +51,6 @@ from homeassistant.helpers import entity_registry as er
from tests.common import MockConfigEntry, patch
@pytest.mark.xfail(
reason="Flaky due to Python 3.14.3 asyncio changes - see home-assistant/core#162263"
)
async def test_default_setup(
hass: HomeAssistant,
entity_registry: er.EntityRegistry,