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

Improve code quality command_line (#65333)

This commit is contained in:
G Johansson
2022-02-12 15:19:37 +01:00
committed by GitHub
parent db6969739f
commit 3771c154fa
11 changed files with 190 additions and 205 deletions

View File

@@ -7,6 +7,8 @@ import tempfile
from typing import Any
from unittest.mock import patch
from pytest import LogCaptureFixture
from homeassistant import setup
from homeassistant.components.notify import DOMAIN
from homeassistant.core import HomeAssistant
@@ -60,7 +62,9 @@ async def test_command_line_output(hass: HomeAssistant) -> None:
assert message == handle.read()
async def test_error_for_none_zero_exit_code(caplog: Any, hass: HomeAssistant) -> None:
async def test_error_for_none_zero_exit_code(
caplog: LogCaptureFixture, hass: HomeAssistant
) -> None:
"""Test if an error is logged for non zero exit codes."""
await setup_test_service(
hass,
@@ -75,7 +79,7 @@ async def test_error_for_none_zero_exit_code(caplog: Any, hass: HomeAssistant) -
assert "Command failed" in caplog.text
async def test_timeout(caplog: Any, hass: HomeAssistant) -> None:
async def test_timeout(caplog: LogCaptureFixture, hass: HomeAssistant) -> None:
"""Test blocking is not forever."""
await setup_test_service(
hass,
@@ -90,7 +94,9 @@ async def test_timeout(caplog: Any, hass: HomeAssistant) -> None:
assert "Timeout" in caplog.text
async def test_subprocess_exceptions(caplog: Any, hass: HomeAssistant) -> None:
async def test_subprocess_exceptions(
caplog: LogCaptureFixture, hass: HomeAssistant
) -> None:
"""Test that notify subprocess exceptions are handled correctly."""
with patch(