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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
Description: Make test functions async
Author: Thomas Goirand <zigo@debian.org>
Bug-Debian: https://bugs.debian.org/1115802
Forwarded: no
Last-Update: 2025-09-29
Index: python-autobahn/autobahn/asyncio/test/test_aio_rawsocket.py
===================================================================
--- python-autobahn.orig/autobahn/asyncio/test/test_aio_rawsocket.py
+++ python-autobahn/autobahn/asyncio/test/test_aio_rawsocket.py
@@ -11,7 +11,8 @@ from autobahn.wamp.types import Transpor
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_sers(event_loop):
+@pytest.mark.asyncio
+async def test_sers():
serializers = get_serializers()
assert len(serializers) > 0
m = serializers[0]().serialize(message.Abort('close'))
@@ -19,7 +20,8 @@ def test_sers(event_loop):
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_prefix(event_loop):
+@pytest.mark.asyncio
+async def test_prefix():
p = PrefixProtocol()
transport = Mock()
receiver = Mock()
@@ -62,7 +64,8 @@ def test_prefix(event_loop):
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_is_closed(event_loop):
+@pytest.mark.asyncio
+async def test_is_closed():
class CP(RawSocketClientProtocol):
@property
def serializer_id(self):
@@ -83,7 +86,8 @@ def test_is_closed(event_loop):
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_raw_socket_server1(event_loop):
+@pytest.mark.asyncio
+async def test_raw_socket_server1():
server = RawSocketServerProtocol()
ser = Mock(return_value=True)
@@ -108,7 +112,8 @@ def test_raw_socket_server1(event_loop):
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_raw_socket_server_errors(event_loop):
+@pytest.mark.asyncio
+async def test_raw_socket_server_errors():
server = RawSocketServerProtocol()
ser = Mock(return_value=True)
@@ -139,7 +144,8 @@ def test_raw_socket_server_errors(event_
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_raw_socket_client1(event_loop):
+@pytest.mark.asyncio
+async def test_raw_socket_client1():
class CP(RawSocketClientProtocol):
@property
def serializer_id(self):
@@ -162,7 +168,8 @@ def test_raw_socket_client1(event_loop):
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_raw_socket_client_error(event_loop):
+@pytest.mark.asyncio
+async def test_raw_socket_client_error():
class CP(RawSocketClientProtocol):
@property
def serializer_id(self):
@@ -181,7 +188,8 @@ def test_raw_socket_client_error(event_l
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_wamp_server(event_loop):
+@pytest.mark.asyncio
+async def test_wamp_server():
transport = Mock(spec_set=('abort', 'close', 'write', 'get_extra_info'))
transport.write = Mock(side_effect=lambda m: messages.append(m))
server = Mock(spec=['onOpen', 'onMessage'])
@@ -209,7 +217,8 @@ def test_wamp_server(event_loop):
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_wamp_client(event_loop):
+@pytest.mark.asyncio
+async def test_wamp_client():
transport = Mock(spec_set=('abort', 'close', 'write', 'get_extra_info'))
transport.write = Mock(side_effect=lambda m: messages.append(m))
client = Mock(spec=['onOpen', 'onMessage'])
Index: python-autobahn/autobahn/asyncio/test/test_aio_websocket.py
===================================================================
--- python-autobahn.orig/autobahn/asyncio/test/test_aio_websocket.py
+++ python-autobahn/autobahn/asyncio/test/test_aio_websocket.py
@@ -23,7 +23,8 @@ async def test_echo_async():
# @pytest.mark.asyncio(forbid_global_loop=True)
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
-def test_websocket_custom_loop(event_loop):
+@pytest.mark.asyncio
+async def test_websocket_custom_loop():
factory = WebSocketServerFactory(loop=event_loop)
server = factory()
transport = Mock()
@@ -32,7 +33,7 @@ def test_websocket_custom_loop(event_loo
@pytest.mark.skipif(not os.environ.get('USE_ASYNCIO', False), reason='test runs on asyncio only')
@pytest.mark.asyncio
-async def test_async_on_connect_server(event_loop):
+async def test_async_on_connect_server():
num = 42
done = txaio.create_future()
|