Add type hints to core tests (#88478)
This commit is contained in:
parent
26755a6841
commit
5f25b71df7
59 changed files with 1068 additions and 547 deletions
|
@ -10,7 +10,9 @@ from homeassistant.util import executor
|
|||
from homeassistant.util.executor import InterruptibleThreadPoolExecutor
|
||||
|
||||
|
||||
async def test_executor_shutdown_can_interrupt_threads(caplog):
|
||||
async def test_executor_shutdown_can_interrupt_threads(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test that the executor shutdown can interrupt threads."""
|
||||
|
||||
iexecutor = InterruptibleThreadPoolExecutor()
|
||||
|
@ -34,7 +36,9 @@ async def test_executor_shutdown_can_interrupt_threads(caplog):
|
|||
assert "time.sleep(0.1)" in caplog.text
|
||||
|
||||
|
||||
async def test_executor_shutdown_only_logs_max_attempts(caplog):
|
||||
async def test_executor_shutdown_only_logs_max_attempts(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test that the executor shutdown will only log max attempts."""
|
||||
|
||||
iexecutor = InterruptibleThreadPoolExecutor()
|
||||
|
@ -52,7 +56,9 @@ async def test_executor_shutdown_only_logs_max_attempts(caplog):
|
|||
iexecutor.shutdown()
|
||||
|
||||
|
||||
async def test_executor_shutdown_does_not_log_shutdown_on_first_attempt(caplog):
|
||||
async def test_executor_shutdown_does_not_log_shutdown_on_first_attempt(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test that the executor shutdown does not log on first attempt."""
|
||||
|
||||
iexecutor = InterruptibleThreadPoolExecutor()
|
||||
|
@ -68,7 +74,7 @@ async def test_executor_shutdown_does_not_log_shutdown_on_first_attempt(caplog):
|
|||
assert "is still running at shutdown" not in caplog.text
|
||||
|
||||
|
||||
async def test_overall_timeout_reached(caplog):
|
||||
async def test_overall_timeout_reached(caplog: pytest.LogCaptureFixture) -> None:
|
||||
"""Test that shutdown moves on when the overall timeout is reached."""
|
||||
|
||||
iexecutor = InterruptibleThreadPoolExecutor()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue