mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
parent
138350fe3d
commit
6ed765698a
@ -10,6 +10,7 @@ from unittest.mock import patch
|
|||||||
|
|
||||||
from typing import Dict, List, Sequence
|
from typing import Dict, List, Sequence
|
||||||
|
|
||||||
|
from homeassistant.core import callback
|
||||||
from homeassistant import bootstrap, loader, setup, config as config_util
|
from homeassistant import bootstrap, loader, setup, config as config_util
|
||||||
import homeassistant.util.yaml as yaml
|
import homeassistant.util.yaml as yaml
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
@ -35,9 +36,9 @@ MOCKS = {
|
|||||||
bootstrap._LOGGER.error),
|
bootstrap._LOGGER.error),
|
||||||
}
|
}
|
||||||
SILENCE = (
|
SILENCE = (
|
||||||
'homeassistant.bootstrap.async_enable_logging',
|
'homeassistant.bootstrap.async_enable_logging', # callback
|
||||||
'homeassistant.bootstrap.clear_secret_cache',
|
'homeassistant.bootstrap.clear_secret_cache',
|
||||||
'homeassistant.bootstrap.async_register_signal_handling',
|
'homeassistant.bootstrap.async_register_signal_handling', # callback
|
||||||
'homeassistant.config.process_ha_config_upgrade',
|
'homeassistant.config.process_ha_config_upgrade',
|
||||||
)
|
)
|
||||||
PATCHES = {}
|
PATCHES = {}
|
||||||
@ -46,8 +47,9 @@ C_HEAD = 'bold'
|
|||||||
ERROR_STR = 'General Errors'
|
ERROR_STR = 'General Errors'
|
||||||
|
|
||||||
|
|
||||||
async def mock_coro(*args):
|
@callback
|
||||||
"""Coroutine that returns None."""
|
def mock_cb(*args):
|
||||||
|
"""Callback that returns None."""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -246,7 +248,7 @@ def check(config_path):
|
|||||||
|
|
||||||
# Patches to skip functions
|
# Patches to skip functions
|
||||||
for sil in SILENCE:
|
for sil in SILENCE:
|
||||||
PATCHES[sil] = patch(sil, return_value=mock_coro())
|
PATCHES[sil] = patch(sil, return_value=mock_cb())
|
||||||
|
|
||||||
# Patches with local mock functions
|
# Patches with local mock functions
|
||||||
for key, val in MOCKS.items():
|
for key, val in MOCKS.items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user