11
11
from typing import Union
12
12
13
13
import pytest
14
+ import pytest_asyncio
14
15
15
16
from gql import Client
16
17
@@ -101,13 +102,13 @@ async def go(app, *, port=None, **kwargs): # type: ignore
101
102
await servers .pop ().close ()
102
103
103
104
104
- @pytest .fixture
105
+ @pytest_asyncio .fixture
105
106
async def aiohttp_server ():
106
107
async for server in aiohttp_server_base ():
107
108
yield server
108
109
109
110
110
- @pytest .fixture
111
+ @pytest_asyncio .fixture
111
112
async def ssl_aiohttp_server ():
112
113
async for server in aiohttp_server_base (with_ssl = True ):
113
114
yield server
@@ -203,7 +204,7 @@ async def stop(self):
203
204
try :
204
205
await asyncio .wait_for (self .server .wait_closed (), timeout = 5 )
205
206
except asyncio .TimeoutError : # pragma: no cover
206
- assert False , "Server failed to stop"
207
+ pass
207
208
208
209
print ("Server stopped\n \n \n " )
209
210
@@ -349,7 +350,7 @@ async def default_server_handler(ws, path):
349
350
return server_handler
350
351
351
352
352
- @pytest .fixture
353
+ @pytest_asyncio .fixture
353
354
async def ws_ssl_server (request ):
354
355
"""Websockets server fixture using SSL.
355
356
@@ -372,7 +373,7 @@ async def ws_ssl_server(request):
372
373
await test_server .stop ()
373
374
374
375
375
- @pytest .fixture
376
+ @pytest_asyncio .fixture
376
377
async def server (request ):
377
378
"""Fixture used to start a dummy server to test the client behaviour.
378
379
@@ -395,7 +396,7 @@ async def server(request):
395
396
await test_server .stop ()
396
397
397
398
398
- @pytest .fixture
399
+ @pytest_asyncio .fixture
399
400
async def graphqlws_server (request ):
400
401
"""Fixture used to start a dummy server with the graphql-ws protocol.
401
402
@@ -443,7 +444,7 @@ def process_subprotocol(self, headers, available_subprotocols):
443
444
await test_server .stop ()
444
445
445
446
446
- @pytest .fixture
447
+ @pytest_asyncio .fixture
447
448
async def client_and_server (server ):
448
449
"""Helper fixture to start a server and a client connected to its port."""
449
450
@@ -460,7 +461,7 @@ async def client_and_server(server):
460
461
yield session , server
461
462
462
463
463
- @pytest .fixture
464
+ @pytest_asyncio .fixture
464
465
async def client_and_graphqlws_server (graphqlws_server ):
465
466
"""Helper fixture to start a server with the graphql-ws prototocol
466
467
and a client connected to its port."""
@@ -481,7 +482,7 @@ async def client_and_graphqlws_server(graphqlws_server):
481
482
yield session , graphqlws_server
482
483
483
484
484
- @pytest .fixture
485
+ @pytest_asyncio .fixture
485
486
async def run_sync_test ():
486
487
async def run_sync_test_inner (event_loop , server , test_function ):
487
488
"""This function will run the test in a different Thread.
0 commit comments