failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) ยท None tool calls ยท 0 s ยท fastapi/fastapi
๐ Fix bug, allow empty path in path operation in prefixless router ## Pull Request ๐ Fix bug, allow empty path in path operation in prefixless router Related to https://github.com/fastapi/fastapi/issues/15762 <!-- Please start with a GitHub Discussion. Once a team member asks you to open a PR, create it and link the discussion here. Obvious typo fixes can be made in a PR without starting a discussion. --> Discussion: <!-- Link to the GitHub Discussion --> ## Description <!-- Write the description of your PR here --> ## AI Disclaimer <!-- If using AI, write here the prompt and model used --> <details> <summary>AI transcript</summary> <!-- Paste here the entire AI transcript --> </details> ## Checklist - [ ] This PR is an obvious typo fix, or it links to a GitHub Discussion for the proposed code change. - [ ] I added tests for the change. - [ ] The new or updated tests fail on the main branch and pass on this PR. - [ ] Coverage stays at 100%. - [ ] The documentation explains the change if needed.
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/fastapi/routing.py
+++ b/fastapi/routing.py
@@ -2435,9 +2435,16 @@ def read_users():
"A path prefix must not end with '/', as the routes will start with '/'"
)
else:
- for r in _iter_included_route_candidates(router.routes):
- path = getattr(r, "path", None)
- name = getattr(r, "name", "unknown")
+ for route, route_context in _iter_routes_with_context(router.routes):
+ if route_context is None:
+ path = getattr(route, "path", None)
+ name = getattr(route, "name", "unknown")
+ elif route_context.starlette_route is not None:
+ path = getattr(route_context.starlette_route, "path", None)
+ name = getattr(route_context.starlette_route, "name", "unknown")
+ else:
+ path = route_context.path
+ name = route_context.name
if path is not None and not path:
raise FastAPIError(
f"Prefix and path cannot be both empty (path operation: {name})".......................F
=================================== FAILURES ===================================
________ test_included_api_route_without_app_scope_returns_405_response ________
async def functions are not natively supported.
You need to install a suitable plugin for your async framework, for example:
- anyio
- pytest-asyncio
- pytest-tornasync
- pytest-trio
- pytest-twisted
=============================== warnings summary ===============================
../../../../../../../Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/overlays/starlette-1.6.0-py3-none-any/starlette/testclient.py:53
/Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/overlays/starlette-1.6.0-py3-none-any/starlette/testclient.py:53: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
_PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]
tests/test_router_include_context.py:649
/private/tmp/swe_work/oracle_refix/fastapi_15763/b/workspace/tests/test_router_include_context.py:649: PytestUnknownMarkWarning: Unknown pytest.mark.anyio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.anyio
tests/test_router_include_context.py:763
/private/tmp/swe_work/oracle_refix/fastapi_15763/b/workspace/tests/test_router_include_context.py:763: PytestUnknownMarkWarning: Unknown pytest.mark.anyio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.anyio
tests/test_router_include_context.py:879
/private/tmp/swe_work/oracle_refix/fastapi_15763/b/workspace/tests/test_router_include_context.py:879: PytestUnknownMarkWarning: Unknown pytest.mark.anyio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.anyio
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 23 passed, 4 warnings in 0.76s