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
|
Description: Python 3.14: fix test_conflict_SSLContext_with_ws_url
Author: Thomas Goirand <zigo@debian.org>
Bug-Debian: https://bugs.debian.org/1122124
Forwarded: no
Last-Update: 2025-12-07
Index: python-autobahn/autobahn/asyncio/test/test_wamp_runner.py
===================================================================
--- python-autobahn.orig/autobahn/asyncio/test/test_wamp_runner.py
+++ python-autobahn/autobahn/asyncio/test/test_wamp_runner.py
@@ -108,27 +108,22 @@ class TestApplicationRunner(unittest.Tes
"""
import ssl
try:
- # Try to create an SSLContext, to be as rigorous as we can be
- # by avoiding making assumptions about the ApplicationRunner
- # implementation. If we happen to be on a Python that has no
- # SSLContext, we pass ssl=True, which will simply cause this
- # test to degenerate to the behavior of
- # test_conflict_SSL_True_with_ws_url (above). In fact, at the
- # moment (2015-05-10), none of this matters because the
- # ApplicationRunner implementation does not check to require
- # that its ssl argument is either a bool or an SSLContext. But
- # that may change, so we should be careful.
ssl.create_default_context
except AttributeError:
context = True
else:
context = ssl.create_default_context()
- with replace_loop(Mock()) as loop:
- loop.run_until_complete = Mock(return_value=(Mock(), Mock()))
+ # Python 3.14 requires a real asyncio loop
+ import asyncio
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
+ try:
runner = ApplicationRunner('ws://127.0.0.1:8080/wss', 'realm',
ssl=context)
error = (r'^ssl argument value passed to ApplicationRunner '
r'conflicts with the "ws:" prefix of the url '
r'argument\. Did you mean to use "wss:"\?$')
self._assertRaisesRegex(Exception, error, runner.run, '_unused_')
+ finally:
+ loop.close()
|