diff --git a/tests/components/mqtt/test_alarm_control_panel.py b/tests/components/mqtt/test_alarm_control_panel.py index 491d824d635..b0817593028 100644 --- a/tests/components/mqtt/test_alarm_control_panel.py +++ b/tests/components/mqtt/test_alarm_control_panel.py @@ -731,7 +731,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one alarm per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_binary_sensor.py b/tests/components/mqtt/test_binary_sensor.py index 55adb70dc6a..fda5dbcb6d5 100644 --- a/tests/components/mqtt/test_binary_sensor.py +++ b/tests/components/mqtt/test_binary_sensor.py @@ -526,7 +526,9 @@ async def test_valid_device_class( assert state.attributes.get("device_class") == "motion" -async def test_invalid_device_class(hass: HomeAssistant, caplog) -> None: +async def test_invalid_device_class( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test the setting of an invalid sensor class.""" assert not await async_setup_component( hass, @@ -671,7 +673,9 @@ async def test_force_update_enabled( assert len(events) == 2 -async def test_off_delay(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_off_delay( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test off_delay option.""" assert await async_setup_component( hass, @@ -789,7 +793,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one sensor per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_button.py b/tests/components/mqtt/test_button.py index 048fcc70d08..61e09e073a6 100644 --- a/tests/components/mqtt/test_button.py +++ b/tests/components/mqtt/test_button.py @@ -277,7 +277,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one button per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_camera.py b/tests/components/mqtt/test_camera.py index bec7eaa5a3f..613e522321d 100644 --- a/tests/components/mqtt/test_camera.py +++ b/tests/components/mqtt/test_camera.py @@ -82,7 +82,7 @@ async def test_run_camera_setup( async def test_run_camera_b64_encoded( hass: HomeAssistant, - hass_client_no_auth, + hass_client_no_auth: ClientSessionGenerator, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test that it fetches the given encoded payload.""" @@ -266,7 +266,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one camera per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_climate.py b/tests/components/mqtt/test_climate.py index 202385b871c..0b60fb7c540 100644 --- a/tests/components/mqtt/test_climate.py +++ b/tests/components/mqtt/test_climate.py @@ -122,7 +122,9 @@ async def test_setup_params( assert state.attributes.get("max_humidity") == DEFAULT_MAX_HUMIDITY -async def test_preset_none_in_preset_modes(hass: HomeAssistant, caplog) -> None: +async def test_preset_none_in_preset_modes( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test the preset mode payload reset configuration.""" config = copy.deepcopy(DEFAULT_CONFIG[mqtt.DOMAIN][climate.DOMAIN]) config["preset_modes"].append("none") @@ -489,7 +491,9 @@ async def test_set_swing_optimistic( assert state.attributes.get("swing_mode") == "off" -async def test_set_swing(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_set_swing( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test setting of new swing mode.""" assert await async_setup_component(hass, mqtt.DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() @@ -1017,7 +1021,9 @@ async def test_set_aux_pessimistic( assert state.attributes.get("aux_heat") == "off" -async def test_set_aux(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_set_aux( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test setting of the aux heating.""" assert await async_setup_component(hass, mqtt.DOMAIN, DEFAULT_CONFIG) await hass.async_block_till_done() @@ -1510,7 +1516,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one climate per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_cover.py b/tests/components/mqtt/test_cover.py index 5295fb5be54..b6514847033 100644 --- a/tests/components/mqtt/test_cover.py +++ b/tests/components/mqtt/test_cover.py @@ -824,7 +824,9 @@ async def test_current_cover_position_inverted( assert hass.states.get("cover.test").state == STATE_CLOSED -async def test_optimistic_position(hass: HomeAssistant, caplog) -> None: +async def test_optimistic_position( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test optimistic position is not supported.""" assert not await async_setup_component( hass, @@ -2567,7 +2569,9 @@ async def test_valid_device_class( assert state.attributes.get("device_class") == "garage" -async def test_invalid_device_class(hass: HomeAssistant, caplog) -> None: +async def test_invalid_device_class( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test the setting of an invalid device class.""" assert not await async_setup_component( hass, @@ -2661,7 +2665,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique_id option only creates one cover per id.""" config = { mqtt.DOMAIN: { @@ -3296,7 +3302,7 @@ async def test_position_via_position_topic_template_return_invalid_json( async def test_set_position_topic_without_get_position_topic_error( - hass: HomeAssistant, caplog + hass: HomeAssistant, caplog: pytest.LogCaptureFixture ) -> None: """Test error when set_position_topic is used without position_topic.""" assert not await async_setup_component( @@ -3342,7 +3348,7 @@ async def test_value_template_without_state_topic_error( async def test_position_template_without_position_topic_error( - hass: HomeAssistant, caplog + hass: HomeAssistant, caplog: pytest.LogCaptureFixture ) -> None: """Test error when position_template is used and position_topic is missing.""" assert not await async_setup_component( @@ -3389,7 +3395,7 @@ async def test_set_position_template_without_set_position_topic( async def test_tilt_command_template_without_tilt_command_topic( - hass: HomeAssistant, caplog + hass: HomeAssistant, caplog: pytest.LogCaptureFixture ) -> None: """Test error when tilt_command_template is used and tilt_command_topic is missing.""" assert not await async_setup_component( @@ -3412,7 +3418,7 @@ async def test_tilt_command_template_without_tilt_command_topic( async def test_tilt_status_template_without_tilt_status_topic_topic( - hass: HomeAssistant, caplog + hass: HomeAssistant, caplog: pytest.LogCaptureFixture ) -> None: """Test error when tilt_status_template is used and tilt_status_topic is missing.""" assert not await async_setup_component( diff --git a/tests/components/mqtt/test_device_tracker.py b/tests/components/mqtt/test_device_tracker.py index 4b632e25d10..37a7daabc34 100644 --- a/tests/components/mqtt/test_device_tracker.py +++ b/tests/components/mqtt/test_device_tracker.py @@ -1,5 +1,4 @@ """The tests for the MQTT device_tracker platform.""" - from unittest.mock import patch import pytest @@ -8,6 +7,7 @@ from homeassistant.components import device_tracker, mqtt from homeassistant.components.mqtt.const import DOMAIN as MQTT_DOMAIN from homeassistant.const import STATE_HOME, STATE_NOT_HOME, STATE_UNKNOWN, Platform from homeassistant.core import HomeAssistant +from homeassistant.helpers import device_registry as dr, entity_registry as er from homeassistant.setup import async_setup_component from .test_common import ( @@ -225,8 +225,8 @@ async def test_device_tracker_discovery_update( async def test_cleanup_device_tracker( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - device_registry, - entity_registry, + device_registry: dr.DeviceRegistry, + entity_registry: er.EntityRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test discovered device is cleaned up when removed from registry.""" diff --git a/tests/components/mqtt/test_device_trigger.py b/tests/components/mqtt/test_device_trigger.py index a15763a9889..18e90121999 100644 --- a/tests/components/mqtt/test_device_trigger.py +++ b/tests/components/mqtt/test_device_trigger.py @@ -1,5 +1,6 @@ """The tests for MQTT device triggers.""" import json +from pathlib import Path from unittest.mock import patch import pytest @@ -44,7 +45,7 @@ def binary_sensor_and_sensor_only(): async def test_get_triggers( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test we get the expected triggers from a discovered mqtt device.""" @@ -80,7 +81,7 @@ async def test_get_triggers( async def test_get_unknown_triggers( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test we don't get unknown triggers.""" @@ -127,7 +128,7 @@ async def test_get_unknown_triggers( async def test_get_non_existing_triggers( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test getting non existing triggers.""" @@ -151,7 +152,7 @@ async def test_get_non_existing_triggers( @pytest.mark.no_fail_on_log_exception async def test_discover_bad_triggers( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test bad discovery message.""" @@ -201,7 +202,7 @@ async def test_discover_bad_triggers( async def test_update_remove_triggers( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test triggers can be updated and removed.""" @@ -270,7 +271,7 @@ async def test_update_remove_triggers( async def test_if_fires_on_mqtt_message( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, calls, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: @@ -349,7 +350,7 @@ async def test_if_fires_on_mqtt_message( async def test_if_fires_on_mqtt_message_template( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, calls, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: @@ -430,7 +431,7 @@ async def test_if_fires_on_mqtt_message_template( async def test_if_fires_on_mqtt_message_late_discover( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, calls, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: @@ -517,7 +518,7 @@ async def test_if_fires_on_mqtt_message_late_discover( async def test_if_fires_on_mqtt_message_after_update( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, calls, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: @@ -597,7 +598,7 @@ async def test_if_fires_on_mqtt_message_after_update( async def test_no_resubscribe_same_topic( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test subscription to topics without change.""" @@ -644,7 +645,7 @@ async def test_no_resubscribe_same_topic( async def test_not_fires_on_mqtt_message_after_remove_by_mqtt( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, calls, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: @@ -710,7 +711,7 @@ async def test_not_fires_on_mqtt_message_after_remove_by_mqtt( async def test_not_fires_on_mqtt_message_after_remove_from_registry( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - device_registry, + device_registry: dr.DeviceRegistry, calls, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: @@ -782,7 +783,7 @@ async def test_not_fires_on_mqtt_message_after_remove_from_registry( async def test_attach_remove( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test attach and removal of trigger.""" @@ -840,7 +841,7 @@ async def test_attach_remove( async def test_attach_remove_late( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test attach and removal of trigger .""" @@ -906,7 +907,7 @@ async def test_attach_remove_late( async def test_attach_remove_late2( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test attach and removal of trigger .""" @@ -1081,7 +1082,7 @@ async def test_entity_device_info_update( async def test_cleanup_trigger( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test trigger discovery topic is cleaned when device is removed from registry.""" @@ -1137,7 +1138,7 @@ async def test_cleanup_trigger( async def test_cleanup_device( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test removal from device registry when trigger is removed.""" @@ -1173,7 +1174,7 @@ async def test_cleanup_device( async def test_cleanup_device_several_triggers( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test removal from device registry when the last trigger is removed.""" @@ -1235,7 +1236,7 @@ async def test_cleanup_device_several_triggers( async def test_cleanup_device_with_entity1( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test removal from device registry for device with entity. @@ -1296,7 +1297,7 @@ async def test_cleanup_device_with_entity1( async def test_cleanup_device_with_entity2( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test removal from device registry for device with entity. @@ -1433,7 +1434,11 @@ async def test_trigger_debug_info( async def test_unload_entry( - hass: HomeAssistant, calls, device_registry, mqtt_mock: MqttMockHAClient, tmp_path + hass: HomeAssistant, + calls, + device_registry: dr.DeviceRegistry, + mqtt_mock: MqttMockHAClient, + tmp_path: Path, ) -> None: """Test unloading the MQTT entry.""" diff --git a/tests/components/mqtt/test_diagnostics.py b/tests/components/mqtt/test_diagnostics.py index 2e95ea015ad..b0ff769e727 100644 --- a/tests/components/mqtt/test_diagnostics.py +++ b/tests/components/mqtt/test_diagnostics.py @@ -1,5 +1,4 @@ """Test MQTT diagnostics.""" - import json from unittest.mock import ANY, patch @@ -8,13 +7,14 @@ import pytest from homeassistant.components import mqtt from homeassistant.const import Platform from homeassistant.core import HomeAssistant +from homeassistant.helpers import device_registry as dr from tests.common import async_fire_mqtt_message from tests.components.diagnostics import ( get_diagnostics_for_config_entry, get_diagnostics_for_device, ) -from tests.typing import MqttMockHAClientGenerator +from tests.typing import ClientSessionGenerator, MqttMockHAClientGenerator default_config = { "birth_message": {}, @@ -49,8 +49,8 @@ def device_tracker_sensor_only(): async def test_entry_diagnostics( hass: HomeAssistant, - device_registry, - hass_client, + device_registry: dr.DeviceRegistry, + hass_client: ClientSessionGenerator, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test config entry diagnostics.""" @@ -172,8 +172,8 @@ async def test_entry_diagnostics( ) async def test_redact_diagnostics( hass: HomeAssistant, - device_registry, - hass_client, + device_registry: dr.DeviceRegistry, + hass_client: ClientSessionGenerator, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test redacting diagnostics.""" diff --git a/tests/components/mqtt/test_discovery.py b/tests/components/mqtt/test_discovery.py index e30b0513992..2d6e13ef08c 100644 --- a/tests/components/mqtt/test_discovery.py +++ b/tests/components/mqtt/test_discovery.py @@ -24,8 +24,7 @@ from homeassistant.const import ( ) from homeassistant.core import Event, HomeAssistant, callback from homeassistant.data_entry_flow import FlowResult -import homeassistant.helpers.device_registry as dr -import homeassistant.helpers.entity_registry as er +from homeassistant.helpers import device_registry as dr, entity_registry as er from homeassistant.helpers.service_info.mqtt import MqttServiceInfo from homeassistant.setup import async_setup_component diff --git a/tests/components/mqtt/test_fan.py b/tests/components/mqtt/test_fan.py index 5a0c756449d..35e40012dea 100644 --- a/tests/components/mqtt/test_fan.py +++ b/tests/components/mqtt/test_fan.py @@ -86,7 +86,9 @@ def fan_platform_only(): yield -async def test_fail_setup_if_no_command_topic(hass: HomeAssistant, caplog) -> None: +async def test_fail_setup_if_no_command_topic( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test if command fails with command topic.""" assert not await async_setup_component( hass, @@ -1776,7 +1778,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique_id option only creates one fan per id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_humidifier.py b/tests/components/mqtt/test_humidifier.py index ac0d645adcf..1a071ab4a81 100644 --- a/tests/components/mqtt/test_humidifier.py +++ b/tests/components/mqtt/test_humidifier.py @@ -131,7 +131,9 @@ async def async_set_humidity( await hass.services.async_call(DOMAIN, SERVICE_SET_HUMIDITY, data, blocking=True) -async def test_fail_setup_if_no_command_topic(hass: HomeAssistant, caplog) -> None: +async def test_fail_setup_if_no_command_topic( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test if command fails with command topic.""" assert not await async_setup_component( hass, @@ -1133,7 +1135,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique_id option only creates one fan per id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_legacy_vacuum.py b/tests/components/mqtt/test_legacy_vacuum.py index a98d7e67870..4028439ef08 100644 --- a/tests/components/mqtt/test_legacy_vacuum.py +++ b/tests/components/mqtt/test_legacy_vacuum.py @@ -292,7 +292,9 @@ async def test_attributes_without_supported_features( assert state.attributes.get(ATTR_FAN_SPEED_LIST) is None -async def test_status(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_status( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test status updates from the vacuum.""" config = deepcopy(DEFAULT_CONFIG[mqtt.DOMAIN][vacuum.DOMAIN]) config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings( @@ -742,7 +744,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one vacuum per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_light.py b/tests/components/mqtt/test_light.py index ad1bd373e1a..7f37c5cc7dd 100644 --- a/tests/components/mqtt/test_light.py +++ b/tests/components/mqtt/test_light.py @@ -243,7 +243,9 @@ def light_platform_only(): yield -async def test_fail_setup_if_no_command_topic(hass: HomeAssistant, caplog) -> None: +async def test_fail_setup_if_no_command_topic( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test if command fails with command topic.""" assert not await async_setup_component( hass, mqtt.DOMAIN, {mqtt.DOMAIN: {light.DOMAIN: {"name": "test"}}} @@ -2074,7 +2076,9 @@ async def test_white_state_update( assert state.attributes.get(light.ATTR_SUPPORTED_COLOR_MODES) == color_modes -async def test_effect(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_effect( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test effect.""" config = { light.DOMAIN: { @@ -2223,7 +2227,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one light per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_light_json.py b/tests/components/mqtt/test_light_json.py index fd118fe6df8..cc14d9cd661 100644 --- a/tests/components/mqtt/test_light_json.py +++ b/tests/components/mqtt/test_light_json.py @@ -163,7 +163,9 @@ class JsonValidator: return json.loads(self.jsondata) == json.loads(other) -async def test_fail_setup_if_no_command_topic(hass: HomeAssistant, caplog) -> None: +async def test_fail_setup_if_no_command_topic( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test if setup fails with no command topic.""" assert not await async_setup_component( hass, @@ -1459,7 +1461,9 @@ async def test_sending_xy_color( ) -async def test_effect(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_effect( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test for effect being sent when included.""" assert await async_setup_component( hass, @@ -1985,7 +1989,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one light per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_light_template.py b/tests/components/mqtt/test_light_template.py index be2051116ed..836b68530f5 100644 --- a/tests/components/mqtt/test_light_template.py +++ b/tests/components/mqtt/test_light_template.py @@ -140,7 +140,9 @@ async def test_setup_fails( assert "Invalid config for [mqtt]" in caplog.text -async def test_rgb_light(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_rgb_light( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test RGB light flags brightness support.""" assert await async_setup_component( hass, @@ -602,7 +604,9 @@ async def test_sending_mqtt_commands_non_optimistic_brightness_template( state = hass.states.get("light.test") -async def test_effect(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_effect( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test effect sent over MQTT in optimistic mode.""" assert await async_setup_component( hass, @@ -655,7 +659,9 @@ async def test_effect(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> assert state.attributes.get("effect") == "colorloop" -async def test_flash(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_flash( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test flash sent over MQTT in optimistic mode.""" assert await async_setup_component( hass, @@ -957,7 +963,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one light per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_lock.py b/tests/components/mqtt/test_lock.py index 44140ccb086..0eb1bbef22f 100644 --- a/tests/components/mqtt/test_lock.py +++ b/tests/components/mqtt/test_lock.py @@ -760,7 +760,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one lock per unique_id.""" config = { mqtt.DOMAIN: { @@ -1010,7 +1012,7 @@ async def test_encoding_subscribable_topics( async def test_setup_manual_entity_from_yaml( - hass: HomeAssistant, caplog: pytest.LogCaptureFixture, tmp_path + hass: HomeAssistant, caplog: pytest.LogCaptureFixture, tmp_path: Path ) -> None: """Test setup manual configured MQTT entity.""" platform = lock.DOMAIN diff --git a/tests/components/mqtt/test_number.py b/tests/components/mqtt/test_number.py index cde6477c954..f8d381ef1a2 100644 --- a/tests/components/mqtt/test_number.py +++ b/tests/components/mqtt/test_number.py @@ -558,7 +558,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one number per unique_id.""" config = { mqtt.DOMAIN: { @@ -756,7 +758,9 @@ async def test_min_max_step_attributes( assert state.attributes.get(ATTR_STEP) == 20 -async def test_invalid_min_max_attributes(hass: HomeAssistant, caplog) -> None: +async def test_invalid_min_max_attributes( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test invalid min/max attributes.""" topic = "test/number" assert not await async_setup_component( diff --git a/tests/components/mqtt/test_scene.py b/tests/components/mqtt/test_scene.py index 57cdbd47c89..57816e6a855 100644 --- a/tests/components/mqtt/test_scene.py +++ b/tests/components/mqtt/test_scene.py @@ -148,7 +148,9 @@ async def test_custom_availability_payload( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one scene per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_select.py b/tests/components/mqtt/test_select.py index df1ed9df8c6..ba32cb10b96 100644 --- a/tests/components/mqtt/test_select.py +++ b/tests/components/mqtt/test_select.py @@ -435,7 +435,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one select per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_sensor.py b/tests/components/mqtt/test_sensor.py index dd4b7e0ae4e..5ba369f465b 100644 --- a/tests/components/mqtt/test_sensor.py +++ b/tests/components/mqtt/test_sensor.py @@ -706,7 +706,9 @@ async def test_default_availability_list_payload_any( ) -async def test_default_availability_list_single(hass: HomeAssistant, caplog) -> None: +async def test_default_availability_list_single( + hass: HomeAssistant, caplog: pytest.LogCaptureFixture +) -> None: """Test availability list and availability_topic are mutually exclusive.""" await help_test_default_availability_list_single( hass, @@ -930,7 +932,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one sensor per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_siren.py b/tests/components/mqtt/test_siren.py index 520590b4ca2..5af903ec046 100644 --- a/tests/components/mqtt/test_siren.py +++ b/tests/components/mqtt/test_siren.py @@ -634,7 +634,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one siren per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_state_vacuum.py b/tests/components/mqtt/test_state_vacuum.py index cfddd85def2..9b0b5ed0a70 100644 --- a/tests/components/mqtt/test_state_vacuum.py +++ b/tests/components/mqtt/test_state_vacuum.py @@ -244,7 +244,9 @@ async def test_commands_without_supported_features( mqtt_mock.async_publish.assert_not_called() -async def test_status(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_status( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test status updates from the vacuum.""" config = deepcopy(DEFAULT_CONFIG[mqtt.DOMAIN][vacuum.DOMAIN]) config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings( @@ -479,7 +481,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one vacuum per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_switch.py b/tests/components/mqtt/test_switch.py index 5eb1cf5b31d..7a129527fd4 100644 --- a/tests/components/mqtt/test_switch.py +++ b/tests/components/mqtt/test_switch.py @@ -403,7 +403,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one switch per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_tag.py b/tests/components/mqtt/test_tag.py index 1ff630ee872..6c0472a11b8 100644 --- a/tests/components/mqtt/test_tag.py +++ b/tests/components/mqtt/test_tag.py @@ -1,6 +1,7 @@ """The tests for MQTT tag scanner.""" import copy import json +from pathlib import Path from unittest.mock import ANY, patch import pytest @@ -63,7 +64,7 @@ def tag_mock(): @pytest.mark.no_fail_on_log_exception async def test_discover_bad_tag( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -90,7 +91,7 @@ async def test_discover_bad_tag( async def test_if_fires_on_mqtt_message_with_device( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -110,7 +111,7 @@ async def test_if_fires_on_mqtt_message_with_device( async def test_if_fires_on_mqtt_message_without_device( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -129,7 +130,7 @@ async def test_if_fires_on_mqtt_message_without_device( async def test_if_fires_on_mqtt_message_with_template( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -167,7 +168,7 @@ async def test_strip_tag_id( async def test_if_fires_on_mqtt_message_after_update_with_device( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -263,7 +264,7 @@ async def test_if_fires_on_mqtt_message_after_update_without_device( async def test_if_fires_on_mqtt_message_after_update_with_template( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -312,7 +313,7 @@ async def test_if_fires_on_mqtt_message_after_update_with_template( async def test_no_resubscribe_same_topic( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test subscription to topics without change.""" @@ -331,7 +332,7 @@ async def test_no_resubscribe_same_topic( async def test_not_fires_on_mqtt_message_after_remove_by_mqtt_with_device( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -404,7 +405,7 @@ async def test_not_fires_on_mqtt_message_after_remove_by_mqtt_without_device( async def test_not_fires_on_mqtt_message_after_remove_from_registry( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -552,7 +553,7 @@ async def test_entity_device_info_update( async def test_cleanup_tag( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test tag discovery topic is cleaned when device is removed from registry.""" @@ -635,7 +636,7 @@ async def test_cleanup_tag( async def test_cleanup_device( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test removal from device registry when tag is removed.""" @@ -663,7 +664,7 @@ async def test_cleanup_device( async def test_cleanup_device_several_tags( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, tag_mock, ) -> None: @@ -711,7 +712,7 @@ async def test_cleanup_device_several_tags( async def test_cleanup_device_with_entity_and_trigger_1( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test removal from device registry for device with tag, entity and trigger. @@ -778,7 +779,7 @@ async def test_cleanup_device_with_entity_and_trigger_1( async def test_cleanup_device_with_entity2( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock_entry_no_yaml_config: MqttMockHAClientGenerator, ) -> None: """Test removal from device registry for device with tag, entity and trigger. @@ -889,10 +890,10 @@ async def test_update_with_bad_config_not_breaks_discovery( async def test_unload_entry( hass: HomeAssistant, - device_registry, + device_registry: dr.DeviceRegistry, mqtt_mock: MqttMockHAClient, tag_mock, - tmp_path, + tmp_path: Path, ) -> None: """Test unloading the MQTT entry.""" diff --git a/tests/components/mqtt/test_text.py b/tests/components/mqtt/test_text.py index 7288e112da4..fcd9b1989df 100644 --- a/tests/components/mqtt/test_text.py +++ b/tests/components/mqtt/test_text.py @@ -439,7 +439,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one text per unique_id.""" config = { mqtt.DOMAIN: { diff --git a/tests/components/mqtt/test_trigger.py b/tests/components/mqtt/test_trigger.py index 451c12f177e..c4b197275a3 100644 --- a/tests/components/mqtt/test_trigger.py +++ b/tests/components/mqtt/test_trigger.py @@ -180,7 +180,9 @@ async def test_if_fires_on_payload_template(hass: HomeAssistant, calls) -> None: assert len(calls) == 1 -async def test_non_allowed_templates(hass: HomeAssistant, calls, caplog) -> None: +async def test_non_allowed_templates( + hass: HomeAssistant, calls, caplog: pytest.LogCaptureFixture +) -> None: """Test non allowed function in template.""" assert await async_setup_component( hass, diff --git a/tests/components/mqtt/test_update.py b/tests/components/mqtt/test_update.py index 3b09b1270dd..d815dbc8b19 100644 --- a/tests/components/mqtt/test_update.py +++ b/tests/components/mqtt/test_update.py @@ -528,7 +528,9 @@ async def test_discovery_update_attr( ) -async def test_unique_id(hass: HomeAssistant, mqtt_mock_entry_with_yaml_config) -> None: +async def test_unique_id( + hass: HomeAssistant, mqtt_mock_entry_with_yaml_config: MqttMockHAClientGenerator +) -> None: """Test unique id option only creates one update per unique_id.""" config = { mqtt.DOMAIN: {