Skip to content

Add daphne to conformance test#40

Merged
anuraaga merged 2 commits intoconnectrpc:mainfrom
anuraaga:daphne-conformance
Oct 31, 2025
Merged

Add daphne to conformance test#40
anuraaga merged 2 commits intoconnectrpc:mainfrom
anuraaga:daphne-conformance

Conversation

@anuraaga
Copy link
Copy Markdown
Collaborator

Trying to find a full-duplex capable server that reliably passes our tests, gave daphne a try. I was optimistic since it supports websockets, but it turns out that their http protocol is completely separate and doesn't support bidi... Oh well, having added the test figured it's worth running it as an option for the others.

Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
break
print(line.decode("utf-8"), end="", file=sys.stderr) # noqa: T201
yield line
except asyncio.CancelledError:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had accidentally added this before I think. It ends up swallowing the error preventing terminate from being called on the subprocesses

Comment thread conformance/test/server.py Outdated
class Args(argparse.Namespace):
mode: Literal["sync", "async"]
server: Literal["granian", "hypercorn", "uvicorn"]
server: Literal["daphne", "granian", "hypercorn", "uvicorn"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should this also have "gunicorn" in the list?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess there's something causing pyright to not flag this



@pytest.mark.parametrize("server", ["granian", "hypercorn", "uvicorn"])
@pytest.mark.parametrize("server", ["daphne", "granian", "hypercorn", "uvicorn"])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should "daphne" be added to test_server_sync, above?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Daphne doesn't support wsgi so only async.

Comment thread pyproject.toml
"pytest-cov==7.0.0",
"ruff~=0.13.2",
"uvicorn==0.37.0",
"Twisted[tls,http2]==25.5.0",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does daphne dep on a lower version of twisted? (oh, ah, I guess it's for http2 support: https://github.com/django/daphne?tab=readme-ov-file#http2-support)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add a comment

@anuraaga anuraaga merged commit f993ce8 into connectrpc:main Oct 31, 2025
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants