Skip to content

Commit 2da6849

Browse files
committed
Cleanup
1 parent 1197ccd commit 2da6849

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

conformance/test/server.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from collections.abc import AsyncIterator, Iterator
1111
from contextlib import ExitStack, closing
1212
from tempfile import NamedTemporaryFile
13-
from typing import TYPE_CHECKING, Literal, TypeVar
13+
from typing import TYPE_CHECKING, Literal, TypeVar, get_args
1414

1515
from _util import create_standard_streams
1616
from gen.connectrpc.conformance.v1.config_pb2 import Code as ConformanceCode
@@ -655,17 +655,18 @@ def _find_free_port():
655655
return s.getsockname()[1]
656656

657657

658+
Server = Literal["daphne", "granian", "gunicorn", "hypercorn", "uvicorn"]
659+
660+
658661
class Args(argparse.Namespace):
659662
mode: Literal["sync", "async"]
660-
server: Literal["daphne", "granian", "hypercorn", "uvicorn"]
663+
server: Server
661664

662665

663666
async def main() -> None:
664667
parser = argparse.ArgumentParser(description="Conformance server")
665668
parser.add_argument("--mode", choices=["sync", "async"])
666-
parser.add_argument(
667-
"--server", choices=["daphne", "granian", "gunicorn", "hypercorn", "uvicorn"]
668-
)
669+
parser.add_argument("--server", choices=get_args(Server))
669670
args = parser.parse_args(namespace=Args())
670671

671672
stdin, stdout = await create_standard_streams()

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ dev = [
5454
"pytest-cov==7.0.0",
5555
"ruff~=0.13.2",
5656
"uvicorn==0.37.0",
57+
# Needed to enable HTTP/2 in daphne
5758
"Twisted[tls,http2]==25.5.0",
5859
"typing_extensions==4.15.0",
5960
"zstandard==0.25.0",

0 commit comments

Comments
 (0)