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
|
From: Colin Watson <cjwatson@debian.org>
Date: Wed, 17 Dec 2025 00:55:56 +0000
Subject: Fix TestSyncifyAsyncContext.test_sync_acontext on Python 3.14
`asyncio.get_event_loop` fails on Python 3.14 if there is no current
event loop. For this particular test of sync behaviour, it seems to
make most sense to explicitly create one.
Forwarded: https://github.com/LonamiWebs/Telethon/pull/4722
Bug-Debian: https://bugs.debian.org/1123319
Last-Update: 2025-12-17
---
tests/telethon/test_helpers.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/telethon/test_helpers.py b/tests/telethon/test_helpers.py
index 3dffdf6..a391f28 100644
--- a/tests/telethon/test_helpers.py
+++ b/tests/telethon/test_helpers.py
@@ -2,6 +2,7 @@
tests for telethon.helpers
"""
+import asyncio
from base64 import b64decode
import pytest
@@ -39,9 +40,9 @@ def test_strip_text():
class TestSyncifyAsyncContext:
class NoopContextManager:
- def __init__(self):
+ def __init__(self, loop=None):
self.count = 0
- self.loop = helpers.get_running_loop()
+ self.loop = loop or helpers.get_running_loop()
async def __aenter__(self):
self.count += 1
@@ -55,7 +56,7 @@ class TestSyncifyAsyncContext:
__exit__ = helpers._sync_exit
def test_sync_acontext(self):
- contm = self.NoopContextManager()
+ contm = self.NoopContextManager(loop=asyncio.new_event_loop())
assert contm.count == 0
with contm:
|