From 5cd958c5477330270c5c293682d53b11c24309dc Mon Sep 17 00:00:00 2001 From: Carl Smedstad Date: Fri, 27 Sep 2024 20:51:37 +0200 Subject: [PATCH] Fix pytest-asyncio deprecation warning in test Introduced in pytest-asyncio in: https://github.com/pytest-dev/pytest-asyncio/pull/648 --- CHANGES/1584.bugfix.rst | 1 + tests/test_utils/test_chat_action.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 CHANGES/1584.bugfix.rst diff --git a/CHANGES/1584.bugfix.rst b/CHANGES/1584.bugfix.rst new file mode 100644 index 00000000..0e1c3a8c --- /dev/null +++ b/CHANGES/1584.bugfix.rst @@ -0,0 +1 @@ +Fix PytestDeprecationWarning thrown by pytest-asyncio when running the tests diff --git a/tests/test_utils/test_chat_action.py b/tests/test_utils/test_chat_action.py index b5c0a965..14048e00 100644 --- a/tests/test_utils/test_chat_action.py +++ b/tests/test_utils/test_chat_action.py @@ -13,9 +13,10 @@ from tests.mocked_bot import MockedBot class TestChatActionSender: - async def test_wait(self, bot: Bot, event_loop: asyncio.BaseEventLoop): + async def test_wait(self, bot: Bot): sender = ChatActionSender.typing(bot=bot, chat_id=42) - event_loop.call_soon(sender._close_event.set) + loop = asyncio.get_running_loop() + loop.call_soon(sender._close_event.set) start = time.monotonic() await sender._wait(1) assert time.monotonic() - start < 1