1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Deprecate async_run_job and async_add_job (#113260)

This commit is contained in:
J. Nick Koston
2024-03-14 09:06:55 -10:00
committed by GitHub
parent aaac879c83
commit 5512e8b789
2 changed files with 56 additions and 0 deletions

View File

@@ -3119,3 +3119,37 @@ async def test_async_add_import_executor_job(hass: HomeAssistant) -> None:
assert await future is evt
assert hass.import_executor._max_workers == 1
async def test_async_run_job_deprecated(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test async_run_job warns about its deprecation."""
async def _test():
pass
hass.async_run_job(_test)
assert (
"Detected code that calls `async_run_job`, which is deprecated "
"and will be removed in Home Assistant 2025.4; Please review "
"https://developers.home-assistant.io/blog/2024/03/13/deprecate_add_run_job"
" for replacement options"
) in caplog.text
async def test_async_add_job_deprecated(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test async_add_job warns about its deprecation."""
async def _test():
pass
hass.async_add_job(_test)
assert (
"Detected code that calls `async_add_job`, which is deprecated "
"and will be removed in Home Assistant 2025.4; Please review "
"https://developers.home-assistant.io/blog/2024/03/13/deprecate_add_run_job"
" for replacement options"
) in caplog.text