Skip to content

Commit

Permalink
tweaks to tests, et al
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Nov 2, 2024
1 parent 4dcedb1 commit 948d614
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/evohomeasync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ def user_data(self) -> _UserDataT | None: # TODO: deprecate?

# User methods...

async def update(
self,
/,
*,
reset_config: bool = False,
) -> None:
"""Update the user and location data."""
await self._populate_user_data(force_refresh=reset_config)
await self._populate_locn_data(force_refresh=reset_config)

async def _populate_user_data(
self, force_refresh: bool = False
) -> dict[str, bool | int | str]:
Expand Down
2 changes: 1 addition & 1 deletion src/evohomeasync2/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ async def __aexit__(
) -> None:
"""Async context manager exit."""
if self._response:
self._response.release() # or: close()
self._response.release()
await self._response.wait_for_close()

def __await__(self) -> aiohttp.ClientResponse:
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_rf/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#
# normally, we want debug flags to be False
_DBG_USE_REAL_AIOHTTP = True
_DBG_USE_REAL_AIOHTTP = False
_DBG_DISABLE_STRICT_ASSERTS = False # of response content-type, schema

if TYPE_CHECKING:
Expand Down
8 changes: 8 additions & 0 deletions tests/tests_rf/faked_server/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,11 @@ async def __aexit__(
exc_tb: TracebackType | None,
) -> None:
pass

def __await__(self) -> Self:
"""Make this class awaitable."""
return self._await_impl().__await__()

async def _await_impl(self) -> Self:
"""Return the actual result."""
return self
2 changes: 1 addition & 1 deletion tests/tests_rf/test_v1_xxxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


async def _test_url_locations(evo: evo1.EvohomeClient) -> None:
# evo.update()
await evo.update()

# evo.broker._headers["sessionId"] = evo.user_info["sessionId"] # what is this?
user_id: int = evo.user_info["userID"] # type: ignore[assignment]
Expand Down

0 comments on commit 948d614

Please sign in to comment.