1111from jsonrpc_async import Server , ProtocolError , TransportError
1212
1313
14+ @pytest .mark .asyncio
1415async def test_send_message_timeout (aiohttp_client ):
1516 """Test the catching of the timeout responses."""
1617
@@ -37,6 +38,7 @@ def create_app():
3738 assert isinstance (transport_error .value .args [1 ], asyncio .TimeoutError )
3839
3940
41+ @pytest .mark .asyncio
4042async def test_send_message (aiohttp_client ):
4143 """Test the sending of messages."""
4244 # catch non-json responses
@@ -100,6 +102,7 @@ def create_app():
100102 "Error calling method 'my_method': Transport Error" )
101103
102104
105+ @pytest .mark .asyncio
103106async def test_exception_passthrough (aiohttp_client ):
104107 async def callback (* args , ** kwargs ):
105108 raise aiohttp .ClientOSError ('aiohttp exception' )
@@ -120,6 +123,7 @@ def create_app():
120123 assert isinstance (transport_error .value .args [1 ], aiohttp .ClientOSError )
121124
122125
126+ @pytest .mark .asyncio
123127async def test_forbid_private_methods (aiohttp_client ):
124128 """Test that we can't call private methods (those starting with '_')."""
125129 def create_app ():
@@ -137,6 +141,7 @@ def create_app():
137141 await server .foo .bar ._baz ()
138142
139143
144+ @pytest .mark .asyncio
140145async def test_headers_passthrough (aiohttp_client ):
141146 """Test that we correctly send RFC headers and merge them with users."""
142147 async def handler (request ):
@@ -170,6 +175,7 @@ async def callback(*args, **kwargs):
170175 await server .foo ()
171176
172177
178+ @pytest .mark .asyncio
173179async def test_method_call (aiohttp_client ):
174180 """Mixing *args and **kwargs is forbidden by the spec."""
175181 def create_app ():
@@ -185,6 +191,7 @@ def create_app():
185191 "JSON-RPC spec forbids mixing arguments and keyword arguments" )
186192
187193
194+ @pytest .mark .asyncio
188195async def test_method_nesting (aiohttp_client ):
189196 """Test that we correctly nest namespaces."""
190197 async def handler (request ):
@@ -211,6 +218,7 @@ def create_app():
211218 "nest.testmethod.some.other.method" ) is True
212219
213220
221+ @pytest .mark .asyncio
214222async def test_calls (aiohttp_client ):
215223 """Test RPC call with positional parameters."""
216224 async def handler1 (request ):
@@ -265,6 +273,7 @@ def create_app():
265273 await server .foobar ({'foo' : 'bar' })
266274
267275
276+ @pytest .mark .asyncio
268277async def test_notification (aiohttp_client ):
269278 """Verify that we ignore the server response."""
270279 async def handler (request ):
@@ -283,6 +292,7 @@ def create_app():
283292 assert await server .subtract (42 , 23 , _notification = True ) is None
284293
285294
295+ @pytest .mark .asyncio
286296async def test_custom_loads (aiohttp_client ):
287297 """Test RPC call with custom load."""
288298 loads_mock = mock .Mock (wraps = json .loads )
@@ -306,6 +316,7 @@ def create_app():
306316 assert loads_mock .call_count == 1
307317
308318
319+ @pytest .mark .asyncio
309320async def test_context_manager (aiohttp_client ):
310321 # catch non-json responses
311322 async def handler1 (request ):
0 commit comments