mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 02:19:31 +00:00
Add type hints to core tests (#88478)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user