-
Notifications
You must be signed in to change notification settings - Fork 580
test(fastmcp): Use AsyncClient for SSE
#5400
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
Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Span Streaming
Bug Fixes 🐛Span Streaming
Other
Internal Changes 🔧Fastmcp
Mcp
Other
🤖 This preview updates automatically when you update the PR. |
AsyncClient for SSE
Codecov Results 📊✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 4.64s All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 13719 uncovered lines. Files with missing lines (180)
Generated by Codecov Action |
sentrivana
left a comment
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.
🥔
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| if request.content: | ||
| request_body = await request.aread() | ||
|
|
||
| body_sender, body_receiver = create_memory_object_stream[bytes](0) # type: ignore |
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.
Bug: The test fixture json_rpc_sse uses create_memory_object_stream[bytes](0), which is AnyIO 4.0+ syntax. However, tox.ini constrains test environments to AnyIO < 4.0, causing a TypeError.
Severity: HIGH
Suggested Fix
Revert the call at tests/conftest.py:842 to use the AnyIO 3.x compatible syntax: create_memory_object_stream(0). This will align the code with the version constraints specified in tox.ini and ensure the tests can run successfully in the configured environments.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: tests/conftest.py#L842
Potential issue: The code at `tests/conftest.py:842` uses
`create_memory_object_stream[bytes](0)`, a syntax valid only for AnyIO version 4.0 and
later. However, the project's `tox.ini` configuration explicitly pins AnyIO to versions
below 4.0.0 for several test environments, including `fastapi` and `starlette`. When
tests are executed in these environments, an older version of AnyIO will be installed.
This will cause a `TypeError: 'function' object is not subscriptable` at runtime because
the AnyIO 3.x version of `create_memory_object_stream` does not support subscripting.
This will cause tests that rely on the `json_rpc_sse` fixture to fail.
Description
Stop mocking transport layer of
mcppackage in tests.The SSE server and client are run in-process by using an in-memory object queue to pass messages.
Issues
Reminders
tox -e linters.feat:,fix:,ref:,meta:)