Skip to content

Commit

Permalink
Use asyncio.create_task instead of asyncio.ensure_future (#1739)
Browse files Browse the repository at this point in the history
  • Loading branch information
iudeen authored Oct 28, 2022
1 parent 5ba3f13 commit 17f765b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/utils.py
Original file line number Diff line number Diff line change
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 17f765b

Please sign in to comment.