Skip to content

Commit

Permalink
Use asyncio.create_task instead of asyncio.ensure_future (encode#…
Browse files Browse the repository at this point in the history
  • Loading branch information
iudeen authored and Kludex committed Oct 29, 2022
1 parent 099dd88 commit 35bdf5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/utils.py
Expand Up @@ -9,13 +9,13 @@
@asynccontextmanager
async def run_server(config: Config, sockets=None):
server = Server(config=config)
cancel_handle = asyncio.ensure_future(server.serve(sockets=sockets))
task = asyncio.create_task(server.serve(sockets=sockets))
await asyncio.sleep(0.1)
try:
yield server
finally:
await server.shutdown()
cancel_handle.cancel()
task.cancel()


@contextmanager
Expand Down

0 comments on commit 35bdf5d

Please sign in to comment.