From b3211fa5eee08c4f45f836976d926e7d69538c95 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Fri, 24 Nov 2023 10:56:17 +0100 Subject: [PATCH] Clean mqtt patch.dict config entries (#104449) --- tests/components/mqtt/test_discovery.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/components/mqtt/test_discovery.py b/tests/components/mqtt/test_discovery.py index 50809a11fc1..017d24a39ce 100644 --- a/tests/components/mqtt/test_discovery.py +++ b/tests/components/mqtt/test_discovery.py @@ -34,6 +34,7 @@ from tests.common import ( MockConfigEntry, async_capture_events, async_fire_mqtt_message, + mock_config_flow, mock_platform, ) from tests.typing import ( @@ -1522,7 +1523,7 @@ async def test_mqtt_integration_discovery_subscribe_unsubscribe( """Test mqtt step.""" return self.async_abort(reason="already_configured") - with patch.dict(config_entries.HANDLERS, {"comp": TestFlow}): + with mock_config_flow("comp", TestFlow): await asyncio.sleep(0) assert ("comp/discovery/#", 0) in help_all_subscribe_calls(mqtt_client_mock) assert not mqtt_client_mock.unsubscribe.called @@ -1575,7 +1576,7 @@ async def test_mqtt_discovery_unsubscribe_once( """Test mqtt step.""" return self.async_abort(reason="already_configured") - with patch.dict(config_entries.HANDLERS, {"comp": TestFlow}): + with mock_config_flow("comp", TestFlow): async_fire_mqtt_message(hass, "comp/discovery/bla/config", "") async_fire_mqtt_message(hass, "comp/discovery/bla/config", "") await asyncio.sleep(0.1)