diff --git a/homeassistant/util/async_.py b/homeassistant/util/async_.py index 8f9526b6800..b898efe49fe 100644 --- a/homeassistant/util/async_.py +++ b/homeassistant/util/async_.py @@ -127,7 +127,7 @@ def check_loop(func: Callable, strict: bool = True) -> None: # Did not source from integration? Hard error. if found_frame is None: raise RuntimeError( - "Detected blocking call inside the event loop. " + f"Detected blocking call to {func.__name__} inside the event loop. " "This is causing stability issues. Please report issue" ) @@ -142,8 +142,9 @@ def check_loop(func: Callable, strict: bool = True) -> None: extra = "" _LOGGER.warning( - "Detected blocking call inside the event loop. This is causing stability issues. " + "Detected blocking call to %s inside the event loop. This is causing stability issues. " "Please report issue%s for %s doing blocking calls at %s, line %s: %s", + func.__name__, extra, integration, found_frame.filename[index:], diff --git a/tests/util/test_async.py b/tests/util/test_async.py index f02d3c03b4b..9bae6f5ebea 100644 --- a/tests/util/test_async.py +++ b/tests/util/test_async.py @@ -105,8 +105,8 @@ async def test_check_loop_async_integration(caplog): ): hasync.check_loop(banned_function) assert ( - "Detected blocking call inside the event loop. This is causing stability issues. " - "Please report issue for hue doing blocking calls at " + "Detected blocking call to banned_function inside the event loop. This is " + "causing stability issues. Please report issue for hue doing blocking calls at " "homeassistant/components/hue/light.py, line 23: self.light.is_on" in caplog.text ) @@ -136,8 +136,8 @@ async def test_check_loop_async_integration_non_strict(caplog): ): hasync.check_loop(banned_function, strict=False) assert ( - "Detected blocking call inside the event loop. This is causing stability issues. " - "Please report issue for hue doing blocking calls at " + "Detected blocking call to banned_function inside the event loop. This is " + "causing stability issues. Please report issue for hue doing blocking calls at " "homeassistant/components/hue/light.py, line 23: self.light.is_on" in caplog.text ) @@ -167,9 +167,10 @@ async def test_check_loop_async_custom(caplog): ): hasync.check_loop(banned_function) assert ( - "Detected blocking call inside the event loop. This is causing stability issues. " - "Please report issue to the custom component author for hue doing blocking calls " - "at custom_components/hue/light.py, line 23: self.light.is_on" in caplog.text + "Detected blocking call to banned_function inside the event loop. This is " + "causing stability issues. Please report issue to the custom component author " + "for hue doing blocking calls at custom_components/hue/light.py, line 23: " + "self.light.is_on" in caplog.text )