diff --git a/tests/conftest.py b/tests/conftest.py index 397d9124e..d7f140007 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -366,3 +366,10 @@ def cluster_handler_factory( return ch return cluster_handler_factory + + +def pytest_collection_modifyitems(config, items): + """Add the looptime marker to all tests except the test_async.py file.""" + for item in items: + if "test_async_.py" not in item.nodeid: + item.add_marker(pytest.mark.looptime) diff --git a/tests/test_climate.py b/tests/test_climate.py index 5df786db2..c8b859aee 100644 --- a/tests/test_climate.py +++ b/tests/test_climate.py @@ -337,7 +337,6 @@ async def test_climate_hvac_action_running_state( assert len(subscriber.mock_calls) == 2 * 6 -@pytest.mark.looptime async def test_sinope_time( zha_gateway: Gateway, ): diff --git a/tests/test_debouncer.py b/tests/test_debouncer.py index 057b5e373..44150752b 100644 --- a/tests/test_debouncer.py +++ b/tests/test_debouncer.py @@ -12,7 +12,6 @@ _LOGGER = logging.getLogger(__name__) -@pytest.mark.looptime async def test_immediate_works(zha_gateway: Gateway) -> None: """Test immediate works.""" calls: list[None] = [] @@ -67,7 +66,6 @@ async def test_immediate_works(zha_gateway: Gateway) -> None: assert debouncer._job.target == debouncer.function -@pytest.mark.looptime async def test_immediate_works_with_schedule_call(zha_gateway: Gateway) -> None: """Test immediate works with scheduled calls.""" calls: list[None] = [] @@ -168,7 +166,6 @@ async def test_immediate_works_with_executor_function(zha_gateway: Gateway) -> N debouncer.async_cancel() -@pytest.mark.looptime async def test_immediate_works_with_passed_callback_function_raises( zha_gateway: Gateway, ) -> None: @@ -232,7 +229,6 @@ def _append_and_raise() -> None: assert debouncer._job.target == debouncer.function -@pytest.mark.looptime async def test_immediate_works_with_passed_coroutine_raises( zha_gateway: Gateway, ) -> None: @@ -296,7 +292,6 @@ async def _append_and_raise() -> None: assert debouncer._job.target == debouncer.function -@pytest.mark.looptime async def test_not_immediate_works(zha_gateway: Gateway) -> None: """Test immediate works.""" calls: list[None] = [] @@ -348,7 +343,6 @@ async def test_not_immediate_works(zha_gateway: Gateway) -> None: assert debouncer._job.target == debouncer.function -@pytest.mark.looptime async def test_not_immediate_works_schedule_call(zha_gateway: Gateway) -> None: """Test immediate works with schedule call.""" calls: list[None] = [] @@ -404,7 +398,6 @@ async def test_not_immediate_works_schedule_call(zha_gateway: Gateway) -> None: assert debouncer._job.target == debouncer.function -@pytest.mark.looptime async def test_immediate_works_with_function_swapped(zha_gateway: Gateway) -> None: """Test immediate works and we can change out the function.""" calls: list[None] = [] @@ -501,7 +494,6 @@ async def _func() -> None: assert debouncer._timer_task is None -@pytest.mark.looptime async def test_background(zha_gateway: Gateway) -> None: """Test background tasks are created when background is True.""" calls: list[None] = [] diff --git a/tests/test_device.py b/tests/test_device.py index b9896e0a5..154670fca 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -103,7 +103,6 @@ async def _send_time_changed(zha_gateway: Gateway, seconds: int): "zha.zigbee.cluster_handlers.general.BasicClusterHandler.async_initialize", new=mock.AsyncMock(), ) -@pytest.mark.looptime async def test_check_available_success( zha_gateway: Gateway, caplog: pytest.LogCaptureFixture, @@ -200,7 +199,6 @@ def _update_last_seen(*args, **kwargs): # pylint: disable=unused-argument "zha.zigbee.cluster_handlers.general.BasicClusterHandler.async_initialize", new=mock.AsyncMock(), ) -@pytest.mark.looptime async def test_check_available_unsuccessful( zha_gateway: Gateway, ) -> None: @@ -272,7 +270,6 @@ async def test_check_available_unsuccessful( "zha.zigbee.cluster_handlers.general.BasicClusterHandler.async_initialize", new=mock.AsyncMock(), ) -@pytest.mark.looptime async def test_check_available_no_basic_cluster_handler( zha_gateway: Gateway, caplog: pytest.LogCaptureFixture, diff --git a/tests/test_device_tracker.py b/tests/test_device_tracker.py index ae0e5d492..1612f937a 100644 --- a/tests/test_device_tracker.py +++ b/tests/test_device_tracker.py @@ -4,7 +4,6 @@ import time from unittest.mock import AsyncMock -import pytest import zigpy.profiles.zha from zigpy.zcl.clusters import general @@ -24,7 +23,6 @@ from zha.application.registries import SMARTTHINGS_ARRIVAL_SENSOR_DEVICE_TYPE -@pytest.mark.looptime async def test_device_tracker( zha_gateway: Gateway, ) -> None: diff --git a/tests/test_fan.py b/tests/test_fan.py index e3b2766ab..8bc96c5f5 100644 --- a/tests/test_fan.py +++ b/tests/test_fan.py @@ -274,7 +274,6 @@ async def async_set_preset_mode( "zigpy.zcl.clusters.hvac.Fan.write_attributes", new=AsyncMock(return_value=zcl_f.WriteAttributesResponse.deserialize(b"\x00")[0]), ) -@pytest.mark.looptime async def test_zha_group_fan_entity( zha_gateway: Gateway, ): diff --git a/tests/test_gateway.py b/tests/test_gateway.py index 6d06f1c6e..63ad41988 100644 --- a/tests/test_gateway.py +++ b/tests/test_gateway.py @@ -476,7 +476,6 @@ async def test_gateway_initialize_bellows_thread( @pytest.mark.parametrize("radio_concurrency", [1, 2, 8]) -@pytest.mark.looptime async def test_startup_concurrency_limit( radio_concurrency: int, zigpy_app_controller: ControllerApplication, @@ -694,7 +693,6 @@ def test_gateway_connection_lost(zha_gateway: Gateway) -> None: ) -@pytest.mark.looptime async def test_pollers_skip( zha_gateway: Gateway, caplog: pytest.LogCaptureFixture, diff --git a/tests/test_light.py b/tests/test_light.py index 42cd27141..952994238 100644 --- a/tests/test_light.py +++ b/tests/test_light.py @@ -276,7 +276,6 @@ async def eWeLink_light_mock( return zha_device -@pytest.mark.looptime async def test_light_refresh( zha_gateway: Gateway, ): @@ -360,7 +359,6 @@ async def test_light_refresh( "device, reporting", [(LIGHT_ON_OFF, (1, 0, 0)), (LIGHT_LEVEL, (1, 1, 0)), (LIGHT_COLOR, (1, 1, 3))], ) -@pytest.mark.looptime async def test_light( zha_gateway: Gateway, device: dict, @@ -594,7 +592,6 @@ async def _async_shift_time(zha_gateway: Gateway): await zha_gateway.async_block_till_done() -@pytest.mark.looptime async def async_test_level_on_off_from_client( zha_gateway: Gateway, on_off_cluster: general.OnOff, @@ -746,7 +743,6 @@ async def async_test_flash_from_client( "zigpy.zcl.clusters.general.OnOff.request", new=AsyncMock(return_value=[sentinel.data, zcl_f.Status.SUCCESS]), ) -@pytest.mark.looptime async def test_zha_group_light_entity( zha_gateway: Gateway, ) -> None: @@ -1890,7 +1886,6 @@ async def test_on_with_off_color(zha_gateway: Gateway) -> None: "zigpy.zcl.clusters.general.LevelControl.request", new=AsyncMock(return_value=[sentinel.data, zcl_f.Status.SUCCESS]), ) -@pytest.mark.looptime async def test_group_member_assume_state(zha_gateway: Gateway) -> None: """Test the group members assume state function.""" diff --git a/tests/test_sensor.py b/tests/test_sensor.py index 5111c8b0c..f1eebd9f3 100644 --- a/tests/test_sensor.py +++ b/tests/test_sensor.py @@ -613,7 +613,6 @@ def assert_state(entity: PlatformEntity, state: Any, unit_of_measurement: str) - assert entity.info_object.unit == unit_of_measurement -@pytest.mark.looptime async def test_electrical_measurement_init( zha_gateway: Gateway, caplog: pytest.LogCaptureFixture, @@ -1026,7 +1025,6 @@ async def test_elec_measurement_sensor_type( assert entity.state["measurement_type"] == expected_type -@pytest.mark.looptime async def test_elec_measurement_sensor_polling(zha_gateway: Gateway) -> None: """Test ZHA electrical measurement sensor polling.""" @@ -1276,7 +1274,6 @@ async def test_last_feeding_size_sensor_v2(zha_gateway: Gateway) -> None: assert_state(entity, 5.0, "g") -@pytest.mark.looptime async def test_device_counter_sensors(zha_gateway: Gateway) -> None: """Test coordinator counter sensor.""" @@ -1317,7 +1314,6 @@ async def test_device_counter_sensors(zha_gateway: Gateway) -> None: assert len(zha_gateway.global_updater._update_listeners) == 3 -@pytest.mark.looptime async def test_device_unavailable_or_disabled_skips_entity_polling( zha_gateway: Gateway, caplog: pytest.LogCaptureFixture, diff --git a/tests/test_siren.py b/tests/test_siren.py index ff9bd2c32..746a79926 100644 --- a/tests/test_siren.py +++ b/tests/test_siren.py @@ -3,7 +3,6 @@ import asyncio from unittest.mock import patch -import pytest from zigpy.const import SIG_EP_PROFILE from zigpy.profiles import zha from zigpy.zcl.clusters import general, security @@ -120,7 +119,6 @@ async def test_siren(zha_gateway: Gateway) -> None: assert entity.state["state"] is True -@pytest.mark.looptime async def test_siren_timed_off(zha_gateway: Gateway) -> None: """Test zha siren platform.""" zha_device, cluster = await siren_mock(zha_gateway) diff --git a/tests/test_switch.py b/tests/test_switch.py index 854e182b6..3cbdc7d38 100644 --- a/tests/test_switch.py +++ b/tests/test_switch.py @@ -220,7 +220,6 @@ async def test_switch(zha_gateway: Gateway) -> None: assert bool(entity.state["state"]) is True -@pytest.mark.looptime async def test_zha_group_switch_entity(zha_gateway: Gateway) -> None: """Test the switch entity for a ZHA group.""" device_switch_1 = await device_switch_1_mock(zha_gateway)