diff --git a/tests/components/numato/conftest.py b/tests/components/numato/conftest.py index c6fd13a099e..f3ae4d5f32b 100644 --- a/tests/components/numato/conftest.py +++ b/tests/components/numato/conftest.py @@ -1,17 +1,18 @@ """Fixtures for numato tests.""" from copy import deepcopy +from typing import Any import pytest from homeassistant.components import numato -from . import numato_mock from .common import NUMATO_CFG +from .numato_mock import NumatoModuleMock @pytest.fixture -def config(): +def config() -> dict[str, Any]: """Provide a copy of the numato domain's test configuration. This helps to quickly change certain aspects of the configuration scoped @@ -21,8 +22,8 @@ def config(): @pytest.fixture -def numato_fixture(monkeypatch): +def numato_fixture(monkeypatch: pytest.MonkeyPatch) -> NumatoModuleMock: """Inject the numato mockup into numato homeassistant module.""" - module_mock = numato_mock.NumatoModuleMock() + module_mock = NumatoModuleMock() monkeypatch.setattr(numato, "gpio", module_mock) return module_mock diff --git a/tests/components/numato/test_binary_sensor.py b/tests/components/numato/test_binary_sensor.py index 524589af198..08506349247 100644 --- a/tests/components/numato/test_binary_sensor.py +++ b/tests/components/numato/test_binary_sensor.py @@ -21,7 +21,7 @@ MOCKUP_ENTITY_IDS = { async def test_failing_setups_no_entities( - hass: HomeAssistant, numato_fixture, monkeypatch + hass: HomeAssistant, numato_fixture, monkeypatch: pytest.MonkeyPatch ) -> None: """When port setup fails, no entity shall be created.""" monkeypatch.setattr(numato_fixture.NumatoDeviceMock, "setup", mockup_raise) diff --git a/tests/components/numato/test_init.py b/tests/components/numato/test_init.py index 35dd102ec9e..4695265f37f 100644 --- a/tests/components/numato/test_init.py +++ b/tests/components/numato/test_init.py @@ -11,7 +11,7 @@ from .common import NUMATO_CFG, mockup_raise, mockup_return async def test_setup_no_devices( - hass: HomeAssistant, numato_fixture, monkeypatch + hass: HomeAssistant, numato_fixture, monkeypatch: pytest.MonkeyPatch ) -> None: """Test handling of an 'empty' discovery. @@ -24,7 +24,7 @@ async def test_setup_no_devices( async def test_fail_setup_raising_discovery( - hass: HomeAssistant, numato_fixture, caplog: pytest.LogCaptureFixture, monkeypatch + hass: HomeAssistant, numato_fixture, monkeypatch: pytest.MonkeyPatch ) -> None: """Test handling of an exception during discovery. @@ -57,7 +57,7 @@ async def test_hass_numato_api_wrong_port_directions( async def test_hass_numato_api_errors( - hass: HomeAssistant, numato_fixture, monkeypatch + hass: HomeAssistant, numato_fixture, monkeypatch: pytest.MonkeyPatch ) -> None: """Test whether Home Assistant numato API (re-)raises errors.""" numato_fixture.discover() diff --git a/tests/components/numato/test_sensor.py b/tests/components/numato/test_sensor.py index 30a9f174941..c652df9b086 100644 --- a/tests/components/numato/test_sensor.py +++ b/tests/components/numato/test_sensor.py @@ -1,5 +1,7 @@ """Tests for the numato sensor platform.""" +import pytest + from homeassistant.const import STATE_UNKNOWN, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import discovery @@ -13,7 +15,7 @@ MOCKUP_ENTITY_IDS = { async def test_failing_setups_no_entities( - hass: HomeAssistant, numato_fixture, monkeypatch + hass: HomeAssistant, numato_fixture, monkeypatch: pytest.MonkeyPatch ) -> None: """When port setup fails, no entity shall be created.""" monkeypatch.setattr(numato_fixture.NumatoDeviceMock, "setup", mockup_raise) @@ -24,7 +26,7 @@ async def test_failing_setups_no_entities( async def test_failing_sensor_update( - hass: HomeAssistant, numato_fixture, monkeypatch + hass: HomeAssistant, numato_fixture, monkeypatch: pytest.MonkeyPatch ) -> None: """Test condition when a sensor update fails.""" monkeypatch.setattr(numato_fixture.NumatoDeviceMock, "adc_read", mockup_raise) diff --git a/tests/components/numato/test_switch.py b/tests/components/numato/test_switch.py index e69b3481b1d..42102ea4869 100644 --- a/tests/components/numato/test_switch.py +++ b/tests/components/numato/test_switch.py @@ -1,5 +1,7 @@ """Tests for the numato switch platform.""" +import pytest + from homeassistant.components import switch from homeassistant.const import ( ATTR_ENTITY_ID, @@ -20,7 +22,7 @@ MOCKUP_ENTITY_IDS = { async def test_failing_setups_no_entities( - hass: HomeAssistant, numato_fixture, monkeypatch + hass: HomeAssistant, numato_fixture, monkeypatch: pytest.MonkeyPatch ) -> None: """When port setup fails, no entity shall be created.""" monkeypatch.setattr(numato_fixture.NumatoDeviceMock, "setup", mockup_raise) @@ -69,7 +71,7 @@ async def test_regular_hass_operations(hass: HomeAssistant, numato_fixture) -> N async def test_failing_hass_operations( - hass: HomeAssistant, numato_fixture, monkeypatch + hass: HomeAssistant, numato_fixture, monkeypatch: pytest.MonkeyPatch ) -> None: """Test failing operations called from within Home Assistant.