Add type hints to integration tests (q-s) (#87706)

This commit is contained in:
epenet 2023-02-08 17:12:54 +01:00 committed by GitHub
parent 3abf7ea18a
commit ba85fdcd61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
97 changed files with 687 additions and 481 deletions

View file

@ -8,6 +8,7 @@ from unittest.mock import MagicMock, patch
import pytest
from homeassistant.components import shell_command
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
@ -27,7 +28,7 @@ def mock_process_creator(error: bool = False):
return mock_process
async def test_executing_service(hass):
async def test_executing_service(hass: HomeAssistant) -> None:
"""Test if able to call a configured service."""
with tempfile.TemporaryDirectory() as tempdirname:
path = os.path.join(tempdirname, "called.txt")
@ -43,7 +44,7 @@ async def test_executing_service(hass):
assert os.path.isfile(path)
async def test_config_not_dict(hass):
async def test_config_not_dict(hass: HomeAssistant) -> None:
"""Test that setup fails if config is not a dict."""
assert not await async_setup_component(
hass,
@ -52,7 +53,7 @@ async def test_config_not_dict(hass):
)
async def test_config_not_valid_service_names(hass):
async def test_config_not_valid_service_names(hass: HomeAssistant) -> None:
"""Test that setup fails if config contains invalid service names."""
assert not await async_setup_component(
hass,
@ -160,7 +161,9 @@ async def test_stderr_captured(mock_output, hass):
@pytest.mark.skip(reason="disabled to check if it fixes flaky CI")
async def test_do_no_run_forever(hass, caplog):
async def test_do_no_run_forever(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test subprocesses terminate after the timeout."""
with patch.object(shell_command, "COMMAND_TIMEOUT", 0.001):