Fix pytest-asyncio deprecation warning in test

Introduced in pytest-asyncio in:
https://github.com/pytest-dev/pytest-asyncio/pull/648
This commit is contained in:
Carl Smedstad 2024-09-27 20:51:37 +02:00
parent 718910f5b5
commit 5cd958c547
No known key found for this signature in database
GPG key ID: 49C93367BA86290E
2 changed files with 4 additions and 2 deletions

1
CHANGES/1584.bugfix.rst Normal file
View file

@ -0,0 +1 @@
Fix PytestDeprecationWarning thrown by pytest-asyncio when running the tests

View file

@ -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