mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Only mock config_entries.HANDLERS for the current test in mock_config_flow (#107357)
This commit is contained in:
parent
65985c4e0b
commit
d6aaaf1f1a
@ -1316,12 +1316,8 @@ async def get_system_health_info(hass: HomeAssistant, domain: str) -> dict[str,
|
|||||||
@contextmanager
|
@contextmanager
|
||||||
def mock_config_flow(domain: str, config_flow: type[ConfigFlow]) -> None:
|
def mock_config_flow(domain: str, config_flow: type[ConfigFlow]) -> None:
|
||||||
"""Mock a config flow handler."""
|
"""Mock a config flow handler."""
|
||||||
handler = config_entries.HANDLERS.get(domain)
|
with patch.dict(config_entries.HANDLERS, {domain: config_flow}):
|
||||||
config_entries.HANDLERS[domain] = config_flow
|
yield
|
||||||
_LOGGER.info("Adding mock config flow: %s", domain)
|
|
||||||
yield
|
|
||||||
if handler:
|
|
||||||
config_entries.HANDLERS[domain] = handler
|
|
||||||
|
|
||||||
|
|
||||||
def mock_integration(
|
def mock_integration(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user