Ignore warning on asyncio.sleep on tests
import asyncio
import os
+import warnings
from contextlib import contextmanager
from pathlib import Path
@@ -15,6 +16,10 @@ from uvicorn import Config, Server
async def run_server(config: Config, sockets=None):
server = Server(config=config)
cancel_handle = asyncio.ensure_future(server.serve(sockets=sockets))
+
+ # Workaround for Python 3.9.7 (see https://bugs.python.org/issue45097)
+ with warnings.catch_warnings():
+ warnings.filterwarnings("ignore", category=DeprecationWarning)
await asyncio.sleep(0.1)
try:
yield server
