Add LogCaptureFixture type hints in tests (#118372)

This commit is contained in:
epenet 2024-05-29 14:10:00 +02:00 committed by GitHub
parent aeee222df4
commit 166c588cac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 98 additions and 47 deletions

View File

@ -76,7 +76,7 @@ async def test_sensors_disappearing(
open_api: OpenAPI, open_api: OpenAPI,
aioambient, aioambient,
config_entry, config_entry,
caplog, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test that we log errors properly.""" """Test that we log errors properly."""

View File

@ -83,7 +83,9 @@ async def test_async_setup_raises_entry_auth_failed(
assert flow["context"]["entry_id"] == entry.entry_id assert flow["context"]["entry_id"] == entry.entry_id
async def test_integration_services(hass: HomeAssistant, cfupdate, caplog) -> None: async def test_integration_services(
hass: HomeAssistant, cfupdate, caplog: pytest.LogCaptureFixture
) -> None:
"""Test integration services.""" """Test integration services."""
instance = cfupdate.return_value instance = cfupdate.return_value
@ -144,7 +146,7 @@ async def test_integration_services_with_issue(hass: HomeAssistant, cfupdate) ->
async def test_integration_services_with_nonexisting_record( async def test_integration_services_with_nonexisting_record(
hass: HomeAssistant, cfupdate, caplog hass: HomeAssistant, cfupdate, caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test integration services.""" """Test integration services."""
instance = cfupdate.return_value instance = cfupdate.return_value
@ -185,7 +187,7 @@ async def test_integration_services_with_nonexisting_record(
async def test_integration_update_interval( async def test_integration_update_interval(
hass: HomeAssistant, hass: HomeAssistant,
cfupdate, cfupdate,
caplog, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test integration update interval.""" """Test integration update interval."""
instance = cfupdate.return_value instance = cfupdate.return_value

View File

@ -74,7 +74,7 @@ async def test_fetching_url(
hass: HomeAssistant, hass: HomeAssistant,
hass_client: ClientSessionGenerator, hass_client: ClientSessionGenerator,
fakeimgbytes_png, fakeimgbytes_png,
caplog: pytest.CaptureFixture, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test that it fetches the given url.""" """Test that it fetches the given url."""
hass.states.async_set("sensor.temp", "http://example.com/0a") hass.states.async_set("sensor.temp", "http://example.com/0a")

View File

@ -471,7 +471,7 @@ async def test_sensor_bad_value(hass: HomeAssistant, setup_comp_2) -> None:
async def test_sensor_bad_value_twice( async def test_sensor_bad_value_twice(
hass: HomeAssistant, setup_comp_2, caplog hass: HomeAssistant, setup_comp_2, caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test sensor that the second bad value is not logged as warning.""" """Test sensor that the second bad value is not logged as warning."""
assert hass.states.get(ENTITY).state == STATE_ON assert hass.states.get(ENTITY).state == STATE_ON

View File

@ -1,5 +1,7 @@
"""Test the send_message service.""" """Test the send_message service."""
import pytest
from homeassistant.components.matrix import ( from homeassistant.components.matrix import (
ATTR_FORMAT, ATTR_FORMAT,
ATTR_IMAGES, ATTR_IMAGES,
@ -14,7 +16,11 @@ from tests.components.matrix.conftest import TEST_BAD_ROOM, TEST_JOINABLE_ROOMS
async def test_send_message( async def test_send_message(
hass: HomeAssistant, matrix_bot: MatrixBot, image_path, matrix_events, caplog hass: HomeAssistant,
matrix_bot: MatrixBot,
image_path,
matrix_events,
caplog: pytest.LogCaptureFixture,
): ):
"""Test the send_message service.""" """Test the send_message service."""
@ -55,7 +61,10 @@ async def test_send_message(
async def test_unsendable_message( async def test_unsendable_message(
hass: HomeAssistant, matrix_bot: MatrixBot, matrix_events, caplog hass: HomeAssistant,
matrix_bot: MatrixBot,
matrix_events,
caplog: pytest.LogCaptureFixture,
): ):
"""Test the send_message service with an invalid room.""" """Test the send_message service with an invalid room."""
assert len(matrix_events) == 0 assert len(matrix_events) == 0

View File

@ -8,6 +8,7 @@ mode (e.g. yaml, ConfigEntry, etc) however some tests override and just run in
relevant modes. relevant modes.
""" """
from collections.abc import Generator
import logging import logging
from typing import Any from typing import Any
from unittest.mock import patch from unittest.mock import patch
@ -48,14 +49,18 @@ def platforms() -> list[str]:
@pytest.fixture @pytest.fixture
def error_caplog(caplog): def error_caplog(
caplog: pytest.LogCaptureFixture,
) -> Generator[pytest.LogCaptureFixture, None, None]:
"""Fixture to capture nest init error messages.""" """Fixture to capture nest init error messages."""
with caplog.at_level(logging.ERROR, logger="homeassistant.components.nest"): with caplog.at_level(logging.ERROR, logger="homeassistant.components.nest"):
yield caplog yield caplog
@pytest.fixture @pytest.fixture
def warning_caplog(caplog): def warning_caplog(
caplog: pytest.LogCaptureFixture,
) -> Generator[pytest.LogCaptureFixture, None, None]:
"""Fixture to capture nest init warning messages.""" """Fixture to capture nest init warning messages."""
with caplog.at_level(logging.WARNING, logger="homeassistant.components.nest"): with caplog.at_level(logging.WARNING, logger="homeassistant.components.nest"):
yield caplog yield caplog
@ -78,7 +83,9 @@ def failing_subscriber(subscriber_side_effect: Any) -> YieldFixture[FakeSubscrib
yield subscriber yield subscriber
async def test_setup_success(hass: HomeAssistant, error_caplog, setup_platform) -> None: async def test_setup_success(
hass: HomeAssistant, error_caplog: pytest.LogCaptureFixture, setup_platform
) -> None:
"""Test successful setup.""" """Test successful setup."""
await setup_platform() await setup_platform()
assert not error_caplog.records assert not error_caplog.records
@ -109,7 +116,10 @@ async def test_setup_configuration_failure(
@pytest.mark.parametrize("subscriber_side_effect", [SubscriberException()]) @pytest.mark.parametrize("subscriber_side_effect", [SubscriberException()])
async def test_setup_susbcriber_failure( async def test_setup_susbcriber_failure(
hass: HomeAssistant, caplog, failing_subscriber, setup_base_platform hass: HomeAssistant,
caplog: pytest.LogCaptureFixture,
failing_subscriber,
setup_base_platform,
) -> None: ) -> None:
"""Test configuration error.""" """Test configuration error."""
await setup_base_platform() await setup_base_platform()
@ -121,7 +131,7 @@ async def test_setup_susbcriber_failure(
async def test_setup_device_manager_failure( async def test_setup_device_manager_failure(
hass: HomeAssistant, caplog, setup_base_platform hass: HomeAssistant, caplog: pytest.LogCaptureFixture, setup_base_platform
) -> None: ) -> None:
"""Test device manager api failure.""" """Test device manager api failure."""
with ( with (
@ -161,7 +171,7 @@ async def test_subscriber_auth_failure(
@pytest.mark.parametrize("subscriber_id", [(None)]) @pytest.mark.parametrize("subscriber_id", [(None)])
async def test_setup_missing_subscriber_id( async def test_setup_missing_subscriber_id(
hass: HomeAssistant, warning_caplog, setup_base_platform hass: HomeAssistant, warning_caplog: pytest.LogCaptureFixture, setup_base_platform
) -> None: ) -> None:
"""Test missing subscriber id from configuration.""" """Test missing subscriber id from configuration."""
await setup_base_platform() await setup_base_platform()
@ -174,7 +184,10 @@ async def test_setup_missing_subscriber_id(
@pytest.mark.parametrize("subscriber_side_effect", [(ConfigurationException())]) @pytest.mark.parametrize("subscriber_side_effect", [(ConfigurationException())])
async def test_subscriber_configuration_failure( async def test_subscriber_configuration_failure(
hass: HomeAssistant, error_caplog, setup_base_platform, failing_subscriber hass: HomeAssistant,
error_caplog: pytest.LogCaptureFixture,
setup_base_platform,
failing_subscriber,
) -> None: ) -> None:
"""Test configuration error.""" """Test configuration error."""
await setup_base_platform() await setup_base_platform()
@ -187,7 +200,7 @@ async def test_subscriber_configuration_failure(
@pytest.mark.parametrize("nest_test_config", [TEST_CONFIGFLOW_APP_CREDS]) @pytest.mark.parametrize("nest_test_config", [TEST_CONFIGFLOW_APP_CREDS])
async def test_empty_config( async def test_empty_config(
hass: HomeAssistant, error_caplog, config, setup_platform hass: HomeAssistant, error_caplog: pytest.LogCaptureFixture, config, setup_platform
) -> None: ) -> None:
"""Test setup is a no-op with not config.""" """Test setup is a no-op with not config."""
await setup_platform() await setup_platform()

View File

@ -122,7 +122,7 @@ async def test_data_caching_error_observation(
freezer: FrozenDateTimeFactory, freezer: FrozenDateTimeFactory,
mock_simple_nws, mock_simple_nws,
no_sensor, no_sensor,
caplog, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test caching of data with errors.""" """Test caching of data with errors."""
instance = mock_simple_nws.return_value instance = mock_simple_nws.return_value
@ -165,7 +165,7 @@ async def test_data_caching_error_observation(
async def test_no_data_error_observation( async def test_no_data_error_observation(
hass: HomeAssistant, mock_simple_nws, no_sensor, caplog hass: HomeAssistant, mock_simple_nws, no_sensor, caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test catching NwsNoDataDrror.""" """Test catching NwsNoDataDrror."""
instance = mock_simple_nws.return_value instance = mock_simple_nws.return_value
@ -183,7 +183,7 @@ async def test_no_data_error_observation(
async def test_no_data_error_forecast( async def test_no_data_error_forecast(
hass: HomeAssistant, mock_simple_nws, no_sensor, caplog hass: HomeAssistant, mock_simple_nws, no_sensor, caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test catching NwsNoDataDrror.""" """Test catching NwsNoDataDrror."""
instance = mock_simple_nws.return_value instance = mock_simple_nws.return_value
@ -203,7 +203,7 @@ async def test_no_data_error_forecast(
async def test_no_data_error_forecast_hourly( async def test_no_data_error_forecast_hourly(
hass: HomeAssistant, mock_simple_nws, no_sensor, caplog hass: HomeAssistant, mock_simple_nws, no_sensor, caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test catching NwsNoDataDrror.""" """Test catching NwsNoDataDrror."""
instance = mock_simple_nws.return_value instance = mock_simple_nws.return_value

View File

@ -20,7 +20,11 @@ from tests.common import MockConfigEntry
], ],
) )
async def test_init_error( async def test_init_error(
hass: HomeAssistant, mock_config_entry: MockConfigEntry, caplog, side_effect, error hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
caplog: pytest.LogCaptureFixture,
side_effect,
error,
) -> None: ) -> None:
"""Test initialization errors.""" """Test initialization errors."""
with patch( with patch(

View File

@ -179,7 +179,11 @@ async def test_generate_image_service_error(
], ],
) )
async def test_init_error( async def test_init_error(
hass: HomeAssistant, mock_config_entry: MockConfigEntry, caplog, side_effect, error hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
caplog: pytest.LogCaptureFixture,
side_effect,
error,
) -> None: ) -> None:
"""Test initialization errors.""" """Test initialization errors."""
with patch( with patch(

View File

@ -682,7 +682,7 @@ hass.states.set('hello.c', c)
], ],
) )
async def test_prohibited_augmented_assignment_operations( async def test_prohibited_augmented_assignment_operations(
hass: HomeAssistant, case: str, error: str, caplog hass: HomeAssistant, case: str, error: str, caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test that prohibited augmented assignment operations raise an error.""" """Test that prohibited augmented assignment operations raise an error."""
hass.async_add_executor_job(execute, hass, "aug_assign_prohibited.py", case, {}) hass.async_add_executor_job(execute, hass, "aug_assign_prohibited.py", case, {})

View File

@ -417,7 +417,9 @@ async def test_keepalive(
) )
async def test_keepalive_2(hass, monkeypatch, caplog): async def test_keepalive_2(
hass: HomeAssistant, monkeypatch, caplog: pytest.LogCaptureFixture
) -> None:
"""Validate very short keepalive values.""" """Validate very short keepalive values."""
keepalive_value = 30 keepalive_value = 30
domain = RFLINK_DOMAIN domain = RFLINK_DOMAIN
@ -443,7 +445,9 @@ async def test_keepalive_2(hass, monkeypatch, caplog):
) )
async def test_keepalive_3(hass, monkeypatch, caplog): async def test_keepalive_3(
hass: HomeAssistant, monkeypatch, caplog: pytest.LogCaptureFixture
) -> None:
"""Validate keepalive=0 value.""" """Validate keepalive=0 value."""
domain = RFLINK_DOMAIN domain = RFLINK_DOMAIN
config = { config = {

View File

@ -82,7 +82,7 @@ async def test_error_on_setup(
hass: HomeAssistant, hass: HomeAssistant,
requests_mock: requests_mock.Mocker, requests_mock: requests_mock.Mocker,
mock_config_entry: MockConfigEntry, mock_config_entry: MockConfigEntry,
caplog, caplog: pytest.LogCaptureFixture,
error_type, error_type,
log_msg, log_msg,
) -> None: ) -> None:
@ -111,7 +111,7 @@ async def test_auth_failure_on_global_update(
hass: HomeAssistant, hass: HomeAssistant,
requests_mock: requests_mock.Mocker, requests_mock: requests_mock.Mocker,
mock_config_entry: MockConfigEntry, mock_config_entry: MockConfigEntry,
caplog, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test authentication failure on global data update.""" """Test authentication failure on global data update."""
mock_config_entry.add_to_hass(hass) mock_config_entry.add_to_hass(hass)
@ -139,7 +139,7 @@ async def test_auth_failure_on_device_update(
hass: HomeAssistant, hass: HomeAssistant,
requests_mock: requests_mock.Mocker, requests_mock: requests_mock.Mocker,
mock_config_entry: MockConfigEntry, mock_config_entry: MockConfigEntry,
caplog, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test authentication failure on device data update.""" """Test authentication failure on device data update."""
mock_config_entry.add_to_hass(hass) mock_config_entry.add_to_hass(hass)
@ -181,7 +181,7 @@ async def test_error_on_global_update(
hass: HomeAssistant, hass: HomeAssistant,
requests_mock: requests_mock.Mocker, requests_mock: requests_mock.Mocker,
mock_config_entry: MockConfigEntry, mock_config_entry: MockConfigEntry,
caplog, caplog: pytest.LogCaptureFixture,
error_type, error_type,
log_msg, log_msg,
) -> None: ) -> None:
@ -222,7 +222,7 @@ async def test_error_on_device_update(
hass: HomeAssistant, hass: HomeAssistant,
requests_mock: requests_mock.Mocker, requests_mock: requests_mock.Mocker,
mock_config_entry: MockConfigEntry, mock_config_entry: MockConfigEntry,
caplog, caplog: pytest.LogCaptureFixture,
error_type, error_type,
log_msg, log_msg,
) -> None: ) -> None:

View File

@ -3,6 +3,7 @@
import logging import logging
from freezegun.api import FrozenDateTimeFactory from freezegun.api import FrozenDateTimeFactory
import pytest
import requests_mock import requests_mock
from homeassistant.components.ring.const import SCAN_INTERVAL from homeassistant.components.ring.const import SCAN_INTERVAL
@ -94,7 +95,7 @@ async def test_only_chime_devices(
hass: HomeAssistant, hass: HomeAssistant,
requests_mock: requests_mock.Mocker, requests_mock: requests_mock.Mocker,
freezer: FrozenDateTimeFactory, freezer: FrozenDateTimeFactory,
caplog, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Tests the update service works correctly if only chimes are returned.""" """Tests the update service works correctly if only chimes are returned."""
await hass.config.async_set_time_zone("UTC") await hass.config.async_set_time_zone("UTC")

View File

@ -405,7 +405,9 @@ async def test_disconnected(
@pytest.mark.parametrize( @pytest.mark.parametrize(
("error_code", "swallow"), [(ERROR_REQUEST_RETRY, True), (1234, False)] ("error_code", "swallow"), [(ERROR_REQUEST_RETRY, True), (1234, False)]
) )
async def test_error_swallowing(hass, caplog, service, error_code, swallow): async def test_error_swallowing(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, service, error_code, swallow
) -> None:
"""Test swallowing specific errors on turn_on and turn_off.""" """Test swallowing specific errors on turn_on and turn_off."""
mocked_device = _create_mocked_device() mocked_device = _create_mocked_device()
entry = MockConfigEntry(domain=songpal.DOMAIN, data=CONF_DATA) entry = MockConfigEntry(domain=songpal.DOMAIN, data=CONF_DATA)

View File

@ -15,7 +15,9 @@ def calls(hass: HomeAssistant) -> list[ServiceCall]:
@pytest.fixture @pytest.fixture
async def start_ha(hass, count, domain, config, caplog): async def start_ha(
hass: HomeAssistant, count, domain, config, caplog: pytest.LogCaptureFixture
):
"""Do setup of integration.""" """Do setup of integration."""
with assert_setup_component(count, domain): with assert_setup_component(count, domain):
assert await async_setup_component( assert await async_setup_component(
@ -30,6 +32,6 @@ async def start_ha(hass, count, domain, config, caplog):
@pytest.fixture @pytest.fixture
async def caplog_setup_text(caplog): async def caplog_setup_text(caplog: pytest.LogCaptureFixture) -> str:
"""Return setup log of integration.""" """Return setup log of integration."""
return caplog.text return caplog.text

View File

@ -213,7 +213,9 @@ async def test_add_bad_dataset(hass: HomeAssistant, dataset, error) -> None:
await dataset_store.async_add_dataset(hass, "test", dataset) await dataset_store.async_add_dataset(hass, "test", dataset)
async def test_update_dataset_newer(hass: HomeAssistant, caplog) -> None: async def test_update_dataset_newer(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test updating a dataset.""" """Test updating a dataset."""
await dataset_store.async_add_dataset(hass, "test", DATASET_1) await dataset_store.async_add_dataset(hass, "test", DATASET_1)
await dataset_store.async_add_dataset(hass, "test", DATASET_1_LARGER_TIMESTAMP) await dataset_store.async_add_dataset(hass, "test", DATASET_1_LARGER_TIMESTAMP)
@ -232,7 +234,9 @@ async def test_update_dataset_newer(hass: HomeAssistant, caplog) -> None:
) )
async def test_update_dataset_older(hass: HomeAssistant, caplog) -> None: async def test_update_dataset_older(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test updating a dataset.""" """Test updating a dataset."""
await dataset_store.async_add_dataset(hass, "test", DATASET_1_LARGER_TIMESTAMP) await dataset_store.async_add_dataset(hass, "test", DATASET_1_LARGER_TIMESTAMP)
await dataset_store.async_add_dataset(hass, "test", DATASET_1) await dataset_store.async_add_dataset(hass, "test", DATASET_1)
@ -354,7 +358,7 @@ async def test_loading_datasets_from_storage(
async def test_migrate_drop_bad_datasets( async def test_migrate_drop_bad_datasets(
hass: HomeAssistant, hass_storage: dict[str, Any], caplog hass: HomeAssistant, hass_storage: dict[str, Any], caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test migrating the dataset store when the store has bad datasets.""" """Test migrating the dataset store when the store has bad datasets."""
hass_storage[dataset_store.STORAGE_KEY] = { hass_storage[dataset_store.STORAGE_KEY] = {
@ -398,7 +402,7 @@ async def test_migrate_drop_bad_datasets(
async def test_migrate_drop_bad_datasets_preferred( async def test_migrate_drop_bad_datasets_preferred(
hass: HomeAssistant, hass_storage: dict[str, Any], caplog hass: HomeAssistant, hass_storage: dict[str, Any], caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test migrating the dataset store when the store has bad datasets.""" """Test migrating the dataset store when the store has bad datasets."""
hass_storage[dataset_store.STORAGE_KEY] = { hass_storage[dataset_store.STORAGE_KEY] = {
@ -429,7 +433,7 @@ async def test_migrate_drop_bad_datasets_preferred(
async def test_migrate_drop_duplicate_datasets( async def test_migrate_drop_duplicate_datasets(
hass: HomeAssistant, hass_storage: dict[str, Any], caplog hass: HomeAssistant, hass_storage: dict[str, Any], caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test migrating the dataset store when the store has duplicated datasets.""" """Test migrating the dataset store when the store has duplicated datasets."""
hass_storage[dataset_store.STORAGE_KEY] = { hass_storage[dataset_store.STORAGE_KEY] = {
@ -466,7 +470,7 @@ async def test_migrate_drop_duplicate_datasets(
async def test_migrate_drop_duplicate_datasets_2( async def test_migrate_drop_duplicate_datasets_2(
hass: HomeAssistant, hass_storage: dict[str, Any], caplog hass: HomeAssistant, hass_storage: dict[str, Any], caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test migrating the dataset store when the store has duplicated datasets.""" """Test migrating the dataset store when the store has duplicated datasets."""
hass_storage[dataset_store.STORAGE_KEY] = { hass_storage[dataset_store.STORAGE_KEY] = {
@ -503,7 +507,7 @@ async def test_migrate_drop_duplicate_datasets_2(
async def test_migrate_drop_duplicate_datasets_preferred( async def test_migrate_drop_duplicate_datasets_preferred(
hass: HomeAssistant, hass_storage: dict[str, Any], caplog hass: HomeAssistant, hass_storage: dict[str, Any], caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test migrating the dataset store when the store has duplicated datasets.""" """Test migrating the dataset store when the store has duplicated datasets."""
hass_storage[dataset_store.STORAGE_KEY] = { hass_storage[dataset_store.STORAGE_KEY] = {
@ -540,7 +544,7 @@ async def test_migrate_drop_duplicate_datasets_preferred(
async def test_migrate_set_default_border_agent_id( async def test_migrate_set_default_border_agent_id(
hass: HomeAssistant, hass_storage: dict[str, Any], caplog hass: HomeAssistant, hass_storage: dict[str, Any], caplog: pytest.LogCaptureFixture
) -> None: ) -> None:
"""Test migrating the dataset store adds default border agent.""" """Test migrating the dataset store adds default border agent."""
hass_storage[dataset_store.STORAGE_KEY] = { hass_storage[dataset_store.STORAGE_KEY] = {

View File

@ -213,7 +213,7 @@ async def test_config_entry_device_config_invalid(
hass: HomeAssistant, hass: HomeAssistant,
mock_discovery: AsyncMock, mock_discovery: AsyncMock,
mock_connect: AsyncMock, mock_connect: AsyncMock,
caplog, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test that an invalid device config logs an error and loads the config entry.""" """Test that an invalid device config logs an error and loads the config entry."""
entry_data = copy.deepcopy(CREATE_ENTRY_DATA_AUTH) entry_data = copy.deepcopy(CREATE_ENTRY_DATA_AUTH)

View File

@ -839,7 +839,9 @@ async def test_configure_reporting(hass: HomeAssistant, endpoint) -> None:
] ]
async def test_invalid_cluster_handler(hass: HomeAssistant, caplog) -> None: async def test_invalid_cluster_handler(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test setting up a cluster handler that fails to match properly.""" """Test setting up a cluster handler that fails to match properly."""
class TestZigbeeClusterHandler(cluster_handlers.ClusterHandler): class TestZigbeeClusterHandler(cluster_handlers.ClusterHandler):
@ -881,7 +883,9 @@ async def test_invalid_cluster_handler(hass: HomeAssistant, caplog) -> None:
assert "missing_attr" in caplog.text assert "missing_attr" in caplog.text
async def test_standard_cluster_handler(hass: HomeAssistant, caplog) -> None: async def test_standard_cluster_handler(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test setting up a cluster handler that matches a standard cluster.""" """Test setting up a cluster handler that matches a standard cluster."""
class TestZigbeeClusterHandler(ColorClusterHandler): class TestZigbeeClusterHandler(ColorClusterHandler):
@ -916,7 +920,9 @@ async def test_standard_cluster_handler(hass: HomeAssistant, caplog) -> None:
) )
async def test_quirk_id_cluster_handler(hass: HomeAssistant, caplog) -> None: async def test_quirk_id_cluster_handler(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test setting up a cluster handler that matches a standard cluster.""" """Test setting up a cluster handler that matches a standard cluster."""
class TestZigbeeClusterHandler(ColorClusterHandler): class TestZigbeeClusterHandler(ColorClusterHandler):

View File

@ -233,7 +233,7 @@ async def test_zha_retry_unique_ids(
config_entry: MockConfigEntry, config_entry: MockConfigEntry,
zigpy_device_mock, zigpy_device_mock,
mock_zigpy_connect: ControllerApplication, mock_zigpy_connect: ControllerApplication,
caplog, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test that ZHA retrying creates unique entity IDs.""" """Test that ZHA retrying creates unique entity IDs."""