Skip to content

Commit

Permalink
mypy, ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Aug 20, 2024
1 parent 4e03732 commit f788f0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/tests_rf/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ async def should_fail(
return content


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

# invoke via:
Expand Down
10 changes: 7 additions & 3 deletions tests/tests_rf/test_v2_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from __future__ import annotations

import asyncio
from datetime import datetime as dt, timedelta as td
from http import HTTPMethod, HTTPStatus

Expand All @@ -26,7 +27,7 @@
instantiate_client,
should_fail,
should_work,
wait_for_comm_task,
wait_for_comm_task_v2 as wait_for_comm_task,
)

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

# dtm = dt.now()
_ = await wait_for_comm_task(evo, task_id, timeout=3)
async with asyncio.timeout(3):
_ = await wait_for_comm_task(evo, task_id)
# assert (dt.now() - dtm).total_seconds() < 2

#
Expand All @@ -118,7 +120,9 @@ async def _test_task_id(evo: evo2.EvohomeClient) -> None:
SZ_UNTIL_TIME: (dt.now() + td(hours=1)).strftime(API_STRFTIME),
}
_ = await should_work(evo, HTTPMethod.PUT, PUT_URL, json=new_mode) # HTTP 201
_ = await wait_for_comm_task(evo, task_id, timeout=3)

async with asyncio.timeout(3):
_ = await wait_for_comm_task(evo, task_id)
status = await should_work(evo, HTTPMethod.GET, GET_URL)

new_mode = { # NOTE: different capitalisation, until time
Expand Down

0 comments on commit f788f0c

Please sign in to comment.