Skip to content

Commit c5e4e97

Browse files
authored
Ignore quirks in Tuya snapshot tests (#172329)
1 parent 3f6e323 commit c5e4e97

19 files changed

Lines changed: 29 additions & 3 deletions

tests/components/tuya/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from unittest.mock import MagicMock, patch
55

66
import pytest
7+
from tuya_device_handlers import TUYA_QUIRKS_REGISTRY
78
from tuya_sharing import CustomerDevice, Manager
89

910
from homeassistant.components.tuya.const import (
@@ -139,3 +140,13 @@ def notification_helper(
139140
) -> TuyaNotificationHelper:
140141
"""Fixture for Tuya NotificationHelper."""
141142
return TuyaNotificationHelper(hass, mock_manager)
143+
144+
145+
@pytest.fixture
146+
def no_quirk() -> Generator[None]:
147+
"""Fixture to bypass all quirk registration."""
148+
with (
149+
patch.dict(TUYA_QUIRKS_REGISTRY._quirks, clear=True),
150+
patch("homeassistant.components.tuya.coordinator.register_tuya_quirks"),
151+
):
152+
yield

tests/components/tuya/test_alarm_control_panel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def platform_autouse():
3333
yield
3434

3535

36+
@pytest.mark.usefixtures("no_quirk")
3637
async def test_platform_setup_and_discovery(
3738
hass: HomeAssistant,
3839
mock_manager: Manager,

tests/components/tuya/test_binary_sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def platform_autouse():
2424
yield
2525

2626

27-
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
27+
@pytest.mark.usefixtures("entity_registry_enabled_by_default", "no_quirk")
2828
async def test_platform_setup_and_discovery(
2929
hass: HomeAssistant,
3030
mock_manager: Manager,

tests/components/tuya/test_button.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def platform_autouse():
2323
yield
2424

2525

26-
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
26+
@pytest.mark.usefixtures("entity_registry_enabled_by_default", "no_quirk")
2727
async def test_platform_setup_and_discovery(
2828
hass: HomeAssistant,
2929
mock_manager: Manager,

tests/components/tuya/test_camera.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def platform_autouse():
3535
yield
3636

3737

38+
@pytest.mark.usefixtures("no_quirk")
3839
async def test_platform_setup_and_discovery(
3940
hass: HomeAssistant,
4041
mock_manager: Manager,

tests/components/tuya/test_climate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def platform_autouse():
5353
yield
5454

5555

56+
@pytest.mark.usefixtures("no_quirk")
5657
async def test_platform_setup_and_discovery(
5758
hass: HomeAssistant,
5859
mock_manager: Manager,

tests/components/tuya/test_cover.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def platform_autouse():
4141
yield
4242

4343

44+
@pytest.mark.usefixtures("no_quirk")
4445
async def test_platform_setup_and_discovery(
4546
hass: HomeAssistant,
4647
mock_manager: Manager,

tests/components/tuya/test_event.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def platform_autouse():
2525

2626

2727
@pytest.mark.freeze_time("2023-11-01 13:14:15+01:00")
28+
@pytest.mark.usefixtures("no_quirk")
2829
async def test_platform_setup_and_discovery(
2930
hass: HomeAssistant,
3031
mock_manager: Manager,

tests/components/tuya/test_fan.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def platform_autouse():
3131
yield
3232

3333

34+
@pytest.mark.usefixtures("no_quirk")
3435
async def test_platform_setup_and_discovery(
3536
hass: HomeAssistant,
3637
mock_manager: Manager,

tests/components/tuya/test_humidifier.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def platform_autouse():
3131
yield
3232

3333

34+
@pytest.mark.usefixtures("no_quirk")
3435
async def test_platform_setup_and_discovery(
3536
hass: HomeAssistant,
3637
mock_manager: Manager,

0 commit comments

Comments
 (0)