projects/aports·blob master · refs

28 lines · 980 B

1From 70ea508aedcc72a19d992a2fa33c34fb3930b577 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <[email protected]>
3Date: Tue, 27 May 2025 21:36:55 +0200
4Subject: [PATCH] Fix tests for Python 3.14+
5
6asyncio.get_event_loop() now raises when there is no event loop.
7
8Fixes https://github.com/Lucretiel/autocommand/issues/39
9---
10 test/test_autoasync.py | 5 ++++-
11 1 file changed, 4 insertions(+), 1 deletion(-)
12
13diff --git a/test/test_autoasync.py b/test/test_autoasync.py
14index 02a820a..c98923e 100644
15--- a/test/test_autoasync.py
16+++ b/test/test_autoasync.py
17@@ -32,7 +32,10 @@ def temporary_context_loop(loop):
18 Set the given loop as the context loop (that is, the loop returned by
19 asyncio.get_event_loop() for the duration of the context)
20 '''
21- old_loop = asyncio.get_event_loop()
22+ try:
23+ old_loop = asyncio.get_event_loop()
24+ except RuntimeError:
25+ old_loop = None
26 asyncio.set_event_loop(loop)
27 try:
28 yield loop