Use mock_config_flow helper in bootstrap tests (#117240)

pull/117210/head
Erik Montnemery 2024-05-11 20:11:42 +02:00 committed by GitHub
parent 021b057a87
commit 35900cd579
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 6 deletions

View File

@ -27,6 +27,7 @@ from .common import (
MockModule,
MockPlatform,
get_test_config_dir,
mock_config_flow,
mock_integration,
mock_platform,
)
@ -1146,7 +1147,6 @@ async def test_bootstrap_empty_integrations(
@pytest.fixture(name="mock_mqtt_config_flow")
def mock_mqtt_config_flow_fixture() -> Generator[None, None, None]:
"""Mock MQTT config flow."""
original_mqtt = HANDLERS.get("mqtt")
@HANDLERS.register("mqtt")
class MockConfigFlow:
@ -1155,11 +1155,8 @@ def mock_mqtt_config_flow_fixture() -> Generator[None, None, None]:
VERSION = 1
MINOR_VERSION = 1
yield
if original_mqtt:
HANDLERS["mqtt"] = original_mqtt
else:
HANDLERS.pop("mqtt")
with mock_config_flow("mqtt", MockConfigFlow):
yield
@pytest.mark.parametrize("integration", ["mqtt_eventstream", "mqtt_statestream"])