mirror of https://github.com/home-assistant/core
Quote domain name in setup logs (#104239)
* Quote domain name in setup logs * Update tests
This commit is contained in:
parent
d90605f9bc
commit
67e25dc0bf
|
@ -157,7 +157,7 @@ async def _async_process_dependencies(
|
|||
|
||||
if failed:
|
||||
_LOGGER.error(
|
||||
"Unable to set up dependencies of %s. Setup failed for dependencies: %s",
|
||||
"Unable to set up dependencies of '%s'. Setup failed for dependencies: %s",
|
||||
integration.domain,
|
||||
", ".join(failed),
|
||||
)
|
||||
|
@ -183,7 +183,7 @@ async def _async_setup_component(
|
|||
custom = "" if integration.is_built_in else "custom integration "
|
||||
link = integration.documentation
|
||||
_LOGGER.error(
|
||||
"Setup failed for %s%s: %s", custom, domain, msg, exc_info=exc_info
|
||||
"Setup failed for %s'%s': %s", custom, domain, msg, exc_info=exc_info
|
||||
)
|
||||
async_notify_setup_error(hass, domain, link)
|
||||
|
||||
|
@ -234,8 +234,8 @@ async def _async_setup_component(
|
|||
):
|
||||
_LOGGER.error(
|
||||
(
|
||||
"The %s integration does not support YAML setup, please remove it from "
|
||||
"your configuration"
|
||||
"The '%s' integration does not support YAML setup, please remove it "
|
||||
"from your configuration"
|
||||
),
|
||||
domain,
|
||||
)
|
||||
|
@ -289,7 +289,7 @@ async def _async_setup_component(
|
|||
except asyncio.TimeoutError:
|
||||
_LOGGER.error(
|
||||
(
|
||||
"Setup of %s is taking longer than %s seconds."
|
||||
"Setup of '%s' is taking longer than %s seconds."
|
||||
" Startup will proceed without waiting any longer"
|
||||
),
|
||||
domain,
|
||||
|
@ -356,7 +356,9 @@ async def async_prepare_setup_platform(
|
|||
def log_error(msg: str) -> None:
|
||||
"""Log helper."""
|
||||
|
||||
_LOGGER.error("Unable to prepare setup for platform %s: %s", platform_path, msg)
|
||||
_LOGGER.error(
|
||||
"Unable to prepare setup for platform '%s': %s", platform_path, msg
|
||||
)
|
||||
async_notify_setup_error(hass, platform_path)
|
||||
|
||||
try:
|
||||
|
|
|
@ -133,6 +133,6 @@ async def test_button_invalid(
|
|||
assert f"Invalid config for 'knx': {error_msg}" in record.message
|
||||
record = caplog.records[1]
|
||||
assert record.levelname == "ERROR"
|
||||
assert "Setup failed for knx: Invalid config." in record.message
|
||||
assert "Setup failed for 'knx': Invalid config." in record.message
|
||||
assert hass.states.get("button.test") is None
|
||||
assert hass.data.get(DOMAIN) is None
|
||||
|
|
|
@ -523,7 +523,7 @@ async def test_platform_error_slow_setup(
|
|||
result = await setup.async_setup_component(hass, "test_component1", {})
|
||||
assert len(called) == 1
|
||||
assert not result
|
||||
assert "test_component1 is taking longer than 0.1 seconds" in caplog.text
|
||||
assert "'test_component1' is taking longer than 0.1 seconds" in caplog.text
|
||||
|
||||
|
||||
async def test_when_setup_already_loaded(hass: HomeAssistant) -> None:
|
||||
|
@ -653,7 +653,7 @@ async def test_integration_logs_is_custom(
|
|||
):
|
||||
result = await setup.async_setup_component(hass, "test_component1", {})
|
||||
assert not result
|
||||
assert "Setup failed for custom integration test_component1: Boom" in caplog.text
|
||||
assert "Setup failed for custom integration 'test_component1': Boom" in caplog.text
|
||||
|
||||
|
||||
async def test_async_get_loaded_integrations(hass: HomeAssistant) -> None:
|
||||
|
@ -735,7 +735,7 @@ async def test_setup_config_entry_from_yaml(
|
|||
) -> None:
|
||||
"""Test attempting to setup an integration which only supports config_entries."""
|
||||
expected_warning = (
|
||||
"The test_integration_only_entry integration does not support YAML setup, "
|
||||
"The 'test_integration_only_entry' integration does not support YAML setup, "
|
||||
"please remove it from your configuration"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue