Skip to content

Commit f788f0c

Browse files
committed
mypy, ruff
1 parent 4e03732 commit f788f0c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tests/tests_rf/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ async def should_fail(
282282
return content
283283

284284

285-
async def wait_for_comm_task(evo: evo2.EvohomeClient, task_id: str) -> bool | None:
285+
async def wait_for_comm_task_v2(evo: evo2.EvohomeClient, task_id: str) -> bool | None:
286286
"""Wait for a communication task (API call) to complete."""
287287

288288
# invoke via:

tests/tests_rf/test_v2_task.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from __future__ import annotations
55

6+
import asyncio
67
from datetime import datetime as dt, timedelta as td
78
from http import HTTPMethod, HTTPStatus
89

@@ -26,7 +27,7 @@
2627
instantiate_client,
2728
should_fail,
2829
should_work,
29-
wait_for_comm_task,
30+
wait_for_comm_task_v2 as wait_for_comm_task,
3031
)
3132

3233
#######################################################################################
@@ -107,7 +108,8 @@ async def _test_task_id(evo: evo2.EvohomeClient) -> None:
107108
# {'commtaskId': '840367013', 'state': 'Succeeded'}
108109

109110
# dtm = dt.now()
110-
_ = await wait_for_comm_task(evo, task_id, timeout=3)
111+
async with asyncio.timeout(3):
112+
_ = await wait_for_comm_task(evo, task_id)
111113
# assert (dt.now() - dtm).total_seconds() < 2
112114

113115
#
@@ -118,7 +120,9 @@ async def _test_task_id(evo: evo2.EvohomeClient) -> None:
118120
SZ_UNTIL_TIME: (dt.now() + td(hours=1)).strftime(API_STRFTIME),
119121
}
120122
_ = await should_work(evo, HTTPMethod.PUT, PUT_URL, json=new_mode) # HTTP 201
121-
_ = await wait_for_comm_task(evo, task_id, timeout=3)
123+
124+
async with asyncio.timeout(3):
125+
_ = await wait_for_comm_task(evo, task_id)
122126
status = await should_work(evo, HTTPMethod.GET, GET_URL)
123127

124128
new_mode = { # NOTE: different capitalisation, until time

0 commit comments

Comments
 (0)