Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mock_config_flow helper in bootstrap tests #117240

Merged
merged 1 commit into from
May 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
MockModule,
MockPlatform,
get_test_config_dir,
mock_config_flow,
mock_integration,
mock_platform,
)
Expand Down Expand Up @@ -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:
Expand All @@ -1155,11 +1155,8 @@ class MockConfigFlow:
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"])
Expand Down