Skip to content

Commit

Permalink
Fix imports + add test for AsyncClient context manager
Browse files Browse the repository at this point in the history
  • Loading branch information
parafoxia committed Feb 17, 2023
1 parent 3606dca commit 9010e93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion analytix/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
import datetime
import logging
import os
import signal
import sys
import typing as t
import warnings
Expand Down
9 changes: 9 additions & 0 deletions tests/client/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ async def test_client_repr(client: AsyncClient):
assert f"{client!r}" == "AsyncClient(project_id='rickroll')"


@mock.patch("builtins.open", mock.mock_open(read_data=create_secrets_file()))
async def test_client_context_manager(client: AsyncClient):
async with AsyncClient("secrets.json") as other:
assert client == other
assert not other._session.closed

assert other._session.closed


def test_client_active_tokens_property(client: AsyncClient):
assert client.active_tokens == client._active_tokens
assert not client.active_tokens
Expand Down

0 comments on commit 9010e93

Please sign in to comment.