mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 06:05:26 +01:00
Adjust thread safety check messages to point to developer docs (#117392)
This commit is contained in:
@@ -3442,7 +3442,8 @@ async def test_async_fire_thread_safety(hass: HomeAssistant) -> None:
|
||||
events = async_capture_events(hass, "test_event")
|
||||
hass.bus.async_fire("test_event")
|
||||
with pytest.raises(
|
||||
RuntimeError, match="Detected code that calls async_fire from a thread."
|
||||
RuntimeError,
|
||||
match="Detected code that calls hass.bus.async_fire from a thread.",
|
||||
):
|
||||
await hass.async_add_executor_job(hass.bus.async_fire, "test_event")
|
||||
|
||||
@@ -3452,7 +3453,8 @@ async def test_async_fire_thread_safety(hass: HomeAssistant) -> None:
|
||||
async def test_async_register_thread_safety(hass: HomeAssistant) -> None:
|
||||
"""Test async_register thread safety."""
|
||||
with pytest.raises(
|
||||
RuntimeError, match="Detected code that calls async_register from a thread."
|
||||
RuntimeError,
|
||||
match="Detected code that calls hass.services.async_register from a thread.",
|
||||
):
|
||||
await hass.async_add_executor_job(
|
||||
hass.services.async_register,
|
||||
@@ -3465,7 +3467,8 @@ async def test_async_register_thread_safety(hass: HomeAssistant) -> None:
|
||||
async def test_async_remove_thread_safety(hass: HomeAssistant) -> None:
|
||||
"""Test async_remove thread safety."""
|
||||
with pytest.raises(
|
||||
RuntimeError, match="Detected code that calls async_remove from a thread."
|
||||
RuntimeError,
|
||||
match="Detected code that calls hass.services.async_remove from a thread.",
|
||||
):
|
||||
await hass.async_add_executor_job(
|
||||
hass.services.async_remove, "test_domain", "test_service"
|
||||
@@ -3479,6 +3482,7 @@ async def test_async_create_task_thread_safety(hass: HomeAssistant) -> None:
|
||||
pass
|
||||
|
||||
with pytest.raises(
|
||||
RuntimeError, match="Detected code that calls async_create_task from a thread."
|
||||
RuntimeError,
|
||||
match="Detected code that calls hass.async_create_task from a thread.",
|
||||
):
|
||||
await hass.async_add_executor_job(hass.async_create_task, _any_coro)
|
||||
|
||||
Reference in New Issue
Block a user