From ef68b8f98378527d6bc84faed94f39e3bfe932e2 Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Wed, 20 Mar 2024 20:45:01 +0100 Subject: [PATCH] chore(tests/asgi): adapt to Uvicorn now propagating signals to retcode --- requirements/tests | 3 +-- tests/asgi/test_asgi_servers.py | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/requirements/tests b/requirements/tests index 3f13db04f..19b34bcd3 100644 --- a/requirements/tests +++ b/requirements/tests @@ -11,8 +11,7 @@ testtools; python_version < '3.10' pytest-asyncio < 0.22.0 aiofiles httpx -# TODO(vytas): Investigate: uvicorn 0.29.0 starts but then catches SIGTERM (?) -uvicorn < 0.29.0 +uvicorn >= 0.17.0 websockets # Handler Specific diff --git a/tests/asgi/test_asgi_servers.py b/tests/asgi/test_asgi_servers.py index 26f51ad0c..234458b68 100644 --- a/tests/asgi/test_asgi_servers.py +++ b/tests/asgi/test_asgi_servers.py @@ -4,6 +4,7 @@ import os import platform import random +import signal import subprocess import sys import time @@ -620,7 +621,10 @@ def server_base_url(request): yield base_url - assert server.returncode == 0 + # NOTE(vytas): Starting with 0.29.0, Uvicorn will propagate signal + # values into the return code (which is a good practice in Unix); + # see also https://github.com/encode/uvicorn/pull/1600 + assert server.returncode in (0, -signal.SIGTERM) break