Include a traceback for non-strict event loop blocking detection (#118620)

This commit is contained in:
J. Nick Koston
2024-06-02 05:36:25 -05:00
committed by GitHub
parent e976db8443
commit 8f94205014
6 changed files with 30 additions and 14 deletions

View File

@@ -27,6 +27,7 @@ async def test_raise_for_blocking_call_async_non_strict_core(
"""Test non_strict_core raise_for_blocking_call detects from event loop without integration context."""
haloop.raise_for_blocking_call(banned_function, strict_core=False)
assert "Detected blocking call to banned_function" in caplog.text
assert "Traceback (most recent call last)" in caplog.text
async def test_raise_for_blocking_call_async_integration(
@@ -130,6 +131,11 @@ async def test_raise_for_blocking_call_async_integration_non_strict(
"please create a bug report at https://github.com/home-assistant/core/issues?"
"q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+hue%22" in caplog.text
)
assert "Traceback (most recent call last)" in caplog.text
assert (
'File "/home/paulus/homeassistant/components/hue/light.py", line 23'
in caplog.text
)
async def test_raise_for_blocking_call_async_custom(
@@ -182,6 +188,11 @@ async def test_raise_for_blocking_call_async_custom(
"please create a bug report at https://github.com/home-assistant/core/issues?"
"q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+hue%22"
) in caplog.text
assert "Traceback (most recent call last)" in caplog.text
assert (
'File "/home/paulus/config/custom_components/hue/light.py", line 23'
in caplog.text
)
async def test_raise_for_blocking_call_sync(