File: 0001-Fix-deprecated-asyncio-loop-retrieval.patch

package info (click to toggle)
python-inject 5.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 224 kB
  • sloc: python: 1,044; makefile: 28; sh: 5
file content (28 lines) | stat: -rw-r--r-- 837 bytes parent folder | download
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
From: Manuel Traut <manut@mecka.net>
Date: Sat, 3 Jan 2026 11:11:19 +0100
Subject: test: Avoid using deprecated asyncio loop retrieval

It will not work with python3.14 anymore.

---
 test/__init__.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/__init__.py b/test/__init__.py
index d4e0635..9ff4a46 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -8,5 +8,10 @@ class BaseTestInject(TestCase):
         inject.clear()
     
     def run_async(self, awaitable):
-        loop = asyncio.get_event_loop()
-        return loop.run_until_complete(awaitable)
\ No newline at end of file
+        loop = asyncio.new_event_loop()
+        asyncio.set_event_loop(loop)
+        try:
+            ret = loop.run_until_complete(awaitable)
+        finally:
+            loop.close()
+        return ret