Add debug mode to catch unsafe thread operations using core helpers (#115390)
* adjust * adjust * fixes * one more * test * debug * move to config * cover * Update homeassistant/core.py * set debug from RuntimeConfig * reduce * fix message * raise * Update homeassistant/core.py * Update homeassistant/core.py * no flood check for raise * cover
This commit is contained in:
@@ -13,7 +13,7 @@ import pytest
|
||||
from homeassistant import bootstrap, loader, runner
|
||||
import homeassistant.config as config_util
|
||||
from homeassistant.config_entries import HANDLERS, ConfigEntry
|
||||
from homeassistant.const import SIGNAL_BOOTSTRAP_INTEGRATIONS
|
||||
from homeassistant.const import CONF_DEBUG, SIGNAL_BOOTSTRAP_INTEGRATIONS
|
||||
from homeassistant.core import CoreState, HomeAssistant, async_get_hass, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
@@ -112,6 +112,16 @@ async def test_empty_setup(hass: HomeAssistant) -> None:
|
||||
assert domain in hass.config.components, domain
|
||||
|
||||
|
||||
@pytest.mark.parametrize("load_registries", [False])
|
||||
async def test_config_does_not_turn_off_debug(hass: HomeAssistant) -> None:
|
||||
"""Test that config does not turn off debug if its turned on by runtime config."""
|
||||
# Mock that its turned on from RuntimeConfig
|
||||
hass.config.debug = True
|
||||
|
||||
await bootstrap.async_from_config_dict({CONF_DEBUG: False}, hass)
|
||||
assert hass.config.debug is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("load_registries", [False])
|
||||
async def test_preload_translations(hass: HomeAssistant) -> None:
|
||||
"""Test translations are preloaded for all frontend deps and base platforms."""
|
||||
@@ -599,6 +609,7 @@ async def test_setup_hass(
|
||||
log_no_color=log_no_color,
|
||||
skip_pip=True,
|
||||
recovery_mode=False,
|
||||
debug=True,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -619,6 +630,9 @@ async def test_setup_hass(
|
||||
assert len(mock_ensure_config_exists.mock_calls) == 1
|
||||
assert len(mock_process_ha_config_upgrade.mock_calls) == 1
|
||||
|
||||
# debug in RuntimeConfig should set it it in hass.config
|
||||
assert hass.config.debug is True
|
||||
|
||||
assert hass == async_get_hass()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user