3
3
4
4
from __future__ import annotations
5
5
6
+ import asyncio
6
7
from datetime import datetime as dt , timedelta as td
7
8
from http import HTTPMethod , HTTPStatus
8
9
26
27
instantiate_client ,
27
28
should_fail ,
28
29
should_work ,
29
- wait_for_comm_task ,
30
+ wait_for_comm_task_v2 as wait_for_comm_task ,
30
31
)
31
32
32
33
#######################################################################################
@@ -107,7 +108,8 @@ async def _test_task_id(evo: evo2.EvohomeClient) -> None:
107
108
# {'commtaskId': '840367013', 'state': 'Succeeded'}
108
109
109
110
# 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 )
111
113
# assert (dt.now() - dtm).total_seconds() < 2
112
114
113
115
#
@@ -118,7 +120,9 @@ async def _test_task_id(evo: evo2.EvohomeClient) -> None:
118
120
SZ_UNTIL_TIME : (dt .now () + td (hours = 1 )).strftime (API_STRFTIME ),
119
121
}
120
122
_ = 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 )
122
126
status = await should_work (evo , HTTPMethod .GET , GET_URL )
123
127
124
128
new_mode = { # NOTE: different capitalisation, until time
0 commit comments