Skip to content

Commit

Permalink
test: provide loop explicitly; aiohttp >= 3.10 reqs a running event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Nov 19, 2024
1 parent d18f26a commit d9a511c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions python/_restclient/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,11 @@ async def test_get_check_cache(basic_test_server):
assert r2.from_cache is True


def test_get_non_async(basic_test_server, loop):
with pytest.warns(DeprecationWarning):
# throws DeprecationWarning b.c. session not create in async func
session = ClientSession()
resp_coro = session.get(basic_test_server["uri"])
resp = loop.run_until_complete(resp_coro)
assert loop.run_until_complete(resp.json()) == basic_test_server["data"]
def test_get_non_async(basic_test_server, event_loop):
session = ClientSession(loop=event_loop)
resp_coro = session.get(basic_test_server["uri"])
resp = event_loop.run_until_complete(resp_coro)
assert event_loop.run_until_complete(resp.json()) == basic_test_server["data"]


@pytest.fixture
Expand Down

0 comments on commit d9a511c

Please sign in to comment.