mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Ensure mock mqtt handler is cleaned up after test_bootstrap_dependencies (#116544)
This commit is contained in:
parent
1db770ab3a
commit
573cd8e94a
@ -1143,16 +1143,10 @@ async def test_bootstrap_empty_integrations(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("integration", ["mqtt_eventstream", "mqtt_statestream"])
|
@pytest.fixture(name="mock_mqtt_config_flow")
|
||||||
@pytest.mark.parametrize("load_registries", [False])
|
def mock_mqtt_config_flow_fixture() -> Generator[None, None, None]:
|
||||||
async def test_bootstrap_dependencies(
|
"""Mock MQTT config flow."""
|
||||||
hass: HomeAssistant,
|
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
integration: str,
|
|
||||||
) -> None:
|
|
||||||
"""Test dependencies are set up correctly,."""
|
|
||||||
|
|
||||||
# Prepare MQTT config entry
|
|
||||||
@HANDLERS.register("mqtt")
|
@HANDLERS.register("mqtt")
|
||||||
class MockConfigFlow:
|
class MockConfigFlow:
|
||||||
"""Mock the MQTT config flow."""
|
"""Mock the MQTT config flow."""
|
||||||
@ -1160,6 +1154,19 @@ async def test_bootstrap_dependencies(
|
|||||||
VERSION = 1
|
VERSION = 1
|
||||||
MINOR_VERSION = 1
|
MINOR_VERSION = 1
|
||||||
|
|
||||||
|
yield
|
||||||
|
HANDLERS.pop("mqtt")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("integration", ["mqtt_eventstream", "mqtt_statestream"])
|
||||||
|
@pytest.mark.parametrize("load_registries", [False])
|
||||||
|
async def test_bootstrap_dependencies(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
caplog: pytest.LogCaptureFixture,
|
||||||
|
integration: str,
|
||||||
|
mock_mqtt_config_flow: None,
|
||||||
|
) -> None:
|
||||||
|
"""Test dependencies are set up correctly,."""
|
||||||
entry = MockConfigEntry(domain="mqtt", data={"broker": "test-broker"})
|
entry = MockConfigEntry(domain="mqtt", data={"broker": "test-broker"})
|
||||||
entry.add_to_hass(hass)
|
entry.add_to_hass(hass)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user