1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
From: Steve Kowalik <steven@wedontsleep.org>
Date: Wed, 30 Jul 2025 12:31:14 +1000
Subject: Stop using the event_loop fixture
pytest-asyncio has deprecated (and in 1.0, removed) the event_loop
fixture, which is only used for one testcase. Use the get_running_loop()
helper function instead.
Origin: upstream, https://github.com/LonamiWebs/Telethon/pull/4670
Bug-Debian: https://bugs.debian.org/1115760
Last-Update: 2025-10-13
---
tests/telethon/test_helpers.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/telethon/test_helpers.py b/tests/telethon/test_helpers.py
index 47705ca..3dffdf6 100644
--- a/tests/telethon/test_helpers.py
+++ b/tests/telethon/test_helpers.py
@@ -39,9 +39,9 @@ def test_strip_text():
class TestSyncifyAsyncContext:
class NoopContextManager:
- def __init__(self, loop):
+ def __init__(self):
self.count = 0
- self.loop = loop
+ self.loop = helpers.get_running_loop()
async def __aenter__(self):
self.count += 1
@@ -54,8 +54,8 @@ class TestSyncifyAsyncContext:
__enter__ = helpers._sync_enter
__exit__ = helpers._sync_exit
- def test_sync_acontext(self, event_loop):
- contm = self.NoopContextManager(event_loop)
+ def test_sync_acontext(self):
+ contm = self.NoopContextManager()
assert contm.count == 0
with contm:
@@ -64,8 +64,8 @@ class TestSyncifyAsyncContext:
assert contm.count == 0
@pytest.mark.asyncio
- async def test_async_acontext(self, event_loop):
- contm = self.NoopContextManager(event_loop)
+ async def test_async_acontext(self):
+ contm = self.NoopContextManager()
assert contm.count == 0
async with contm:
|