failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) ยท None tool calls ยท 0 s ยท fastapi/fastapi
๐ Fix support for `StreamingResponse`s with dependencies with `yield` or `UploadFile`s, close after the response is done ๐ Fix support for `StreamingResponse`s with dependencies with `yield` or `UploadFile`s, close after the response is done --- There's (again) an `AsyncExitStack` middleware, now used mainly to close objects after the response is done. There's also a new wrapper duplicating some logic in Starlette but creating an `AsyncExitStack` for the exit code in dependencies with `yield`, for regular responses and WebSockets as well. The exit code of dependencies with `yield` is now executed after the response is done.
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
..F
=================================== FAILURES ===================================
_____________________________ test_broken_no_raise _____________________________
def test_broken_no_raise():
"""
When a dependency with yield raises after the yield (not in an except), the
response is already "successfully" sent back to the client, but there's still
an error in the server afterwards, an exception is raised and captured or shown
in the server logs.
"""
with TestClient(app, raise_server_exceptions=False) as client:
response = client.get("/broken")
> assert response.status_code == 200
E assert 500 == 200
E + where 500 = <Response [500 Internal Server Error]>.status_code
tests/test_dependency_after_yield_raise.py:61: AssertionError
=============================== warnings summary ===============================
../../../../../../../Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/overlays/starlette-0.48.0-py3-none-any/starlette/testclient.py:51
/Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/overlays/starlette-0.48.0-py3-none-any/starlette/testclient.py:51: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
_PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 2 passed, 1 warning in 0.51s