Skip to content

Commit 3d93ced

Browse files
committed
refactor: use asyncio mode in tests
1 parent 3913e01 commit 3d93ced

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

tests/test_api.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from unittest.mock import patch
22

33
import paho.mqtt.client as mqtt
4-
import pytest
54

65
from roborock import (
76
HomeData,
@@ -24,13 +23,12 @@ def test_can_create_prepared_request():
2423
PreparedRequest("https://sample.com")
2524

2625

27-
def test_can_create_mqtt_roborock():
26+
async def test_can_create_mqtt_roborock():
2827
home_data = HomeData.from_dict(HOME_DATA_RAW)
2928
device_info = DeviceData(device=home_data.devices[0], model=home_data.products[0].model)
3029
RoborockMqttClientV1(UserData.from_dict(USER_DATA), device_info)
3130

3231

33-
@pytest.mark.asyncio
3432
async def test_sync_connect(mqtt_client):
3533
with patch("paho.mqtt.client.Client.connect", return_value=mqtt.MQTT_ERR_SUCCESS):
3634
with patch("paho.mqtt.client.Client.loop_start", return_value=mqtt.MQTT_ERR_SUCCESS):
@@ -41,7 +39,6 @@ async def test_sync_connect(mqtt_client):
4139
connected_future.cancel()
4240

4341

44-
@pytest.mark.asyncio
4542
async def test_get_base_url_no_url():
4643
rc = RoborockApiClient("[email protected]")
4744
with patch("roborock.web_api.PreparedRequest.request") as mock_request:
@@ -50,7 +47,6 @@ async def test_get_base_url_no_url():
5047
assert rc.base_url == "https://sample.com"
5148

5249

53-
@pytest.mark.asyncio
5450
async def test_request_code():
5551
rc = RoborockApiClient("[email protected]")
5652
with patch("roborock.web_api.RoborockApiClient._get_base_url"), patch(
@@ -60,7 +56,6 @@ async def test_request_code():
6056
await rc.request_code()
6157

6258

63-
@pytest.mark.asyncio
6459
async def test_get_home_data():
6560
rc = RoborockApiClient("[email protected]")
6661
with patch("roborock.web_api.RoborockApiClient._get_base_url"), patch(
@@ -77,7 +72,6 @@ async def test_get_home_data():
7772
assert result == HomeData.from_dict(HOME_DATA_RAW)
7873

7974

80-
@pytest.mark.asyncio
8175
async def test_get_dust_collection_mode():
8276
home_data = HomeData.from_dict(HOME_DATA_RAW)
8377
device_info = DeviceData(device=home_data.devices[0], model=home_data.products[0].model)
@@ -89,7 +83,6 @@ async def test_get_dust_collection_mode():
8983
assert dust.mode == RoborockDockDustCollectionModeCode.light
9084

9185

92-
@pytest.mark.asyncio
9386
async def test_get_mop_wash_mode():
9487
home_data = HomeData.from_dict(HOME_DATA_RAW)
9588
device_info = DeviceData(device=home_data.devices[0], model=home_data.products[0].model)
@@ -102,7 +95,6 @@ async def test_get_mop_wash_mode():
10295
assert mop_wash.wash_interval == 1500
10396

10497

105-
@pytest.mark.asyncio
10698
async def test_get_washing_mode():
10799
home_data = HomeData.from_dict(HOME_DATA_RAW)
108100
device_info = DeviceData(device=home_data.devices[0], model=home_data.products[0].model)
@@ -115,7 +107,6 @@ async def test_get_washing_mode():
115107
assert washing_mode.wash_mode == 2
116108

117109

118-
@pytest.mark.asyncio
119110
async def test_get_prop():
120111
home_data = HomeData.from_dict(HOME_DATA_RAW)
121112
device_info = DeviceData(device=home_data.devices[0], model=home_data.products[0].model)

0 commit comments

Comments
 (0)