File support-python314.patch of Package python-pika

From 114dbb5bc8a88c056cfb72697390f5cf7957580e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Sat, 7 Jun 2025 20:06:42 +0200
Subject: [PATCH] Fix tests with Python 3.14, except RuntimeError from
 asyncio.get_event_loop

Fixes https://github.com/pika/pika/issues/1479
---
 tests/unit/io_services_test_stubs_test.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: pika-1.3.2/tests/unit/io_services_test_stubs_test.py
===================================================================
--- pika-1.3.2.orig/tests/unit/io_services_test_stubs_test.py
+++ pika-1.3.2/tests/unit/io_services_test_stubs_test.py
@@ -42,7 +42,11 @@ _SUPPORTED_LOOP_CLASSES = {
 if asyncio is not None:
     if sys.platform == 'win32':
         asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
-    _SUPPORTED_LOOP_CLASSES.add(asyncio.get_event_loop().__class__)
+    try:
+        loop = asyncio.get_event_loop()
+    except RuntimeError:
+        loop = asyncio.new_event_loop()
+    _SUPPORTED_LOOP_CLASSES.add(loop.__class__)
 
 
 class TestStartCalledFromOtherThreadAndWithVaryingNativeLoops(
openSUSE Build Service is sponsored by