Skip to content

Commit

Permalink
chore(tests/asgi): adapt to Uvicorn now propagating signals to retcode
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 committed Mar 20, 2024
1 parent 6141517 commit ef68b8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions requirements/tests
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion tests/asgi/test_asgi_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import platform
import random
import signal
import subprocess
import sys
import time
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ef68b8f

Please sign in to comment.