Skip to content

Commit c412de6

Browse files
committed
tweaks to tests
1 parent a1d51c7 commit c412de6

File tree

4 files changed

+19
-30
lines changed

4 files changed

+19
-30
lines changed

tests/tests_rf/test_v1_apis.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
import pytest
99

10-
import evohomeasync as ev1
11-
1210
from .conftest import _DBG_USE_REAL_AIOHTTP
1311
from .const import ExitTestReason
1412

1513
if TYPE_CHECKING:
1614
from collections.abc import Awaitable
1715

16+
import evohomeasync as ev1
17+
1818

1919
#######################################################################################
2020

@@ -40,13 +40,8 @@ async def _test_client_apis(evo: ev1.EvohomeClient) -> None:
4040
#######################################################################################
4141

4242

43+
@pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason=ExitTestReason.NOT_IMPLEMENTED)
4344
async def test_client_apis(evo1: Awaitable[ev1.EvohomeClient]) -> None:
4445
"""Test _populate_user_data() & _populate_full_data()"""
4546

46-
if not _DBG_USE_REAL_AIOHTTP:
47-
pytest.skip(ExitTestReason.NOT_IMPLEMENTED)
48-
49-
try:
50-
await _test_client_apis(await evo1)
51-
except ev1.AuthenticationFailedError as err:
52-
pytest.fail(ExitTestReason.AUTHENTICATE_FAIL + f": {err}")
47+
await _test_client_apis(await evo1)

tests/tests_rf/test_v1_xxxx.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88

99
import pytest
1010

11-
import evohomeasync as ev1
12-
1311
from .conftest import _DBG_USE_REAL_AIOHTTP
1412
from .const import ExitTestReason
1513
from .helpers import should_fail_v1, should_work_v1
1614

1715
if TYPE_CHECKING:
1816
from collections.abc import Awaitable
1917

18+
import evohomeasync as ev1
19+
2020

2121
#######################################################################################
2222

@@ -961,25 +961,15 @@ async def _test_client_apis(evo: ev1.EvohomeClient) -> None:
961961
#######################################################################################
962962

963963

964+
@pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason=ExitTestReason.NOT_IMPLEMENTED)
964965
async def test_locations(evo1: Awaitable[ev1.EvohomeClient]) -> None:
965966
"""Test /locations"""
966967

967-
if not _DBG_USE_REAL_AIOHTTP:
968-
pytest.skip(ExitTestReason.NOT_IMPLEMENTED)
969-
970-
try:
971-
await _test_url_locations(await evo1)
972-
except ev1.AuthenticationFailedError as err:
973-
pytest.fail(ExitTestReason.AUTHENTICATE_FAIL + f": {err}")
968+
await _test_url_locations(await evo1)
974969

975970

971+
@pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason=ExitTestReason.NOT_IMPLEMENTED)
976972
async def test_client_apis(evo1: Awaitable[ev1.EvohomeClient]) -> None:
977973
"""Test _populate_user_data() & _populate_full_data()"""
978974

979-
if not _DBG_USE_REAL_AIOHTTP:
980-
pytest.skip(ExitTestReason.NOT_IMPLEMENTED)
981-
982-
try:
983-
await _test_client_apis(await evo1)
984-
except ev1.AuthenticationFailedError as err:
985-
pytest.fail(ExitTestReason.AUTHENTICATE_FAIL + f": {err}")
975+
await _test_client_apis(await evo1)

tests/tests_rf/test_v2_apis.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from . import faked_server as faked
2525
from .conftest import _DBG_USE_REAL_AIOHTTP, aiohttp
2626
from .const import ExitTestReason
27+
from .helpers import instantiate_client_v2
2728

2829
if TYPE_CHECKING:
2930
from collections.abc import Awaitable
@@ -174,10 +175,15 @@ async def _test_system_apis(evo: ev2.EvohomeClient) -> None:
174175
#######################################################################################
175176

176177

177-
async def test_basics(evo2: Awaitable[ev2.EvohomeClient]) -> None:
178+
async def test_basics(
179+
user_credentials: tuple[str, str],
180+
session: aiohttp.ClientSession | faked.ClientSession,
181+
) -> None:
178182
"""Test authentication, `user_account()` and `installation()`."""
179183

180-
await _test_basics_apis(await evo2)
184+
await _test_basics_apis(
185+
await instantiate_client_v2(user_credentials, session, dont_login=True)
186+
)
181187

182188

183189
async def test_sched_(evo2: Awaitable[ev2.EvohomeClient]) -> None:

tests/tests_rf/test_v2_task.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,8 @@ async def _test_task_id(evo: ev2.EvohomeClient) -> None:
190190
#######################################################################################
191191

192192

193+
@pytest.mark.skipif(not _DBG_USE_REAL_AIOHTTP, reason=ExitTestReason.NOT_IMPLEMENTED)
193194
async def _out_test_task_id(evo2: Awaitable[ev2.EvohomeClient]) -> None:
194195
"""Test /location/{locationId}/status"""
195196

196-
if not _DBG_USE_REAL_AIOHTTP:
197-
pytest.skip(ExitTestReason.NOT_IMPLEMENTED)
198-
199197
await _test_task_id(await evo2)

0 commit comments

Comments
 (0)