diff --git a/homeassistant/setup.py b/homeassistant/setup.py index bf405d5deda..9b705b4735e 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -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: diff --git a/tests/components/knx/test_button.py b/tests/components/knx/test_button.py index 08afabbbdf8..a905e66fe5d 100644 --- a/tests/components/knx/test_button.py +++ b/tests/components/knx/test_button.py @@ -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 diff --git a/tests/test_setup.py b/tests/test_setup.py index 8b3b79ac48c..66a62511fcb 100644 --- a/tests/test_setup.py +++ b/tests/test_setup.py @@ -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" )