-
-
Notifications
You must be signed in to change notification settings - Fork 954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgraded to AnyIO 4.0 #2211
Upgraded to AnyIO 4.0 #2211
Conversation
(I'll rebase this on top of #2178, fyi) |
Would you like me to add an extra test job to test against both AnyIO 3.x and 4.x? There is no 4.x release available yet though, hence the git pointer in |
tests/middleware/test_wsgi.py
Outdated
@@ -66,7 +68,7 @@ def test_wsgi_exception(test_client_factory): | |||
# The HTTP protocol implementations would catch this error and return 500. | |||
app = WSGIMiddleware(raise_exception) | |||
client = test_client_factory(app) | |||
with pytest.raises(RuntimeError): | |||
with pytest.raises(RuntimeError), convert_excgroups(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use the ExceptionGroup
here. I'm fine with this break, since we intend to remove WSGIMiddleware
.
tests/middleware/test_base.py
Outdated
@@ -15,6 +15,8 @@ | |||
from starlette.testclient import TestClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if we maintain the tests unchanged, and unpack the ExceptionGroup
on the BaseHTTPMiddleware
in case we have a single exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @agronholm! 🙏
Summary
This updates Starlette to work with AnyIO 4.0. Note that while this PR maintains compatibility with AnyIO 3.x, some of the new AnyIO behavior is likely to bleed through in some use cases at least.
Checklist