From 0f773b608d506ae089424592245e4cad969676d8 Mon Sep 17 00:00:00 2001
From: Yuri Konotopov <ykonotopov@gnome.org>
Date: Sat, 12 Jul 2025 17:58:17 +0400
Subject: [PATCH] Do not use `event_loop` fixture in the
 asyncio_exception_handler test

PytestDeprecationWarning: asyncio_exception_handler is asynchronous and
explicitly requests the "event_loop" fixture. Asynchronous fixtures and
test functions should use "asyncio.get_running_loop()" instead.

Signed-off-by: Yuri Konotopov <ykonotopov@gnome.org>
Forwarded: https://github.com/mosquito/caio/pull/46
---
 tests/test_asyncio_adapter.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- caio.orig/tests/test_asyncio_adapter.py
+++ caio/tests/test_asyncio_adapter.py
@@ -89,10 +89,11 @@ async def test_bad_file_descritor(tmp_pa
 
 
 @pytest.fixture
-async def asyncio_exception_handler(event_loop):
+async def asyncio_exception_handler():
     handler = Mock(
         side_effect=lambda _loop, ctx: _loop.default_exception_handler(ctx)
     )
+    event_loop = asyncio.get_running_loop()
     current_handler = event_loop.get_exception_handler()
     event_loop.set_exception_handler(handler=handler)
     yield handler
