Make Light and Fan a common module interface (#911)

This commit is contained in:
Steven B
2024-05-13 17:34:44 +01:00
committed by GitHub
parent d7b00336f4
commit 33d839866e
32 changed files with 544 additions and 342 deletions

View File

@@ -1,5 +1,6 @@
import logging
import sys
from unittest.mock import patch
import pytest
from pytest_mock import MockerFixture
@@ -180,11 +181,10 @@ async def test_feature_setters(dev: Device, mocker: MockerFixture):
async def _test_features(dev):
exceptions = []
query = mocker.patch.object(dev.protocol, "query")
for feat in dev.features.values():
query.reset_mock()
try:
await _test_feature(feat, query)
with patch.object(feat.device.protocol, "query") as query:
await _test_feature(feat, query)
# we allow our own exceptions to avoid mocking valid responses
except KasaException:
pass