mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Ensure mqtt handler is restored if its already registered in bootstrap test (#116549)
This commit is contained in:
parent
573cd8e94a
commit
f73c55b434
@ -1146,6 +1146,7 @@ async def test_bootstrap_empty_integrations(
|
|||||||
@pytest.fixture(name="mock_mqtt_config_flow")
|
@pytest.fixture(name="mock_mqtt_config_flow")
|
||||||
def mock_mqtt_config_flow_fixture() -> Generator[None, None, None]:
|
def mock_mqtt_config_flow_fixture() -> Generator[None, None, None]:
|
||||||
"""Mock MQTT config flow."""
|
"""Mock MQTT config flow."""
|
||||||
|
original_mqtt = HANDLERS.get("mqtt")
|
||||||
|
|
||||||
@HANDLERS.register("mqtt")
|
@HANDLERS.register("mqtt")
|
||||||
class MockConfigFlow:
|
class MockConfigFlow:
|
||||||
@ -1155,7 +1156,10 @@ def mock_mqtt_config_flow_fixture() -> Generator[None, None, None]:
|
|||||||
MINOR_VERSION = 1
|
MINOR_VERSION = 1
|
||||||
|
|
||||||
yield
|
yield
|
||||||
HANDLERS.pop("mqtt")
|
if original_mqtt:
|
||||||
|
HANDLERS["mqtt"] = original_mqtt
|
||||||
|
else:
|
||||||
|
HANDLERS.pop("mqtt")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("integration", ["mqtt_eventstream", "mqtt_statestream"])
|
@pytest.mark.parametrize("integration", ["mqtt_eventstream", "mqtt_statestream"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user