From d9a511c0e8f613c032c1b134a7fa636730403a5e Mon Sep 17 00:00:00 2001 From: Austin Raney Date: Tue, 19 Nov 2024 15:23:38 -0500 Subject: [PATCH] test: provide loop explicitly; aiohttp >= 3.10 reqs a running event loop --- python/_restclient/tests/test_client.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/python/_restclient/tests/test_client.py b/python/_restclient/tests/test_client.py index 214adef0..1e0e145a 100644 --- a/python/_restclient/tests/test_client.py +++ b/python/_restclient/tests/test_client.py @@ -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