Skip to content

Conversation

@alexander-alderman-webb
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Jan 30, 2026

Description

Stop mocking transport layer of mcp package in tests.

The SSE server and client are run in-process by using an in-memory object queue to pass messages.

Issues

Reminders

@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Span Streaming

  • feat(span-streaming): Add spans to telemetry pipeline, add span name and attributes (3) by sentrivana in #5399
  • feat(span-streaming): Add span batcher (2) by sentrivana in #5398
  • feat(span-streaming): Add experimental trace_lifecycle switch (1) by sentrivana in #5397

Bug Fixes 🐛

Span Streaming

  • fix(span-streaming): Always preserialize attributes by sentrivana in #5407
  • fix(span-streaming): Warn about thread usage if any batcher is active by sentrivana in #5408

Other

  • fix(arq): handle settings_cls passed as keyword argument by nc9 in #5393
  • fix(dramatiq): cleanup isolated scope and transaction when message is skipped by frankie567 in #5346
  • fix(google-genai): deactivate google genai when langchain is used by shellmayr in #5389

Internal Changes 🔧

Fastmcp

  • test(fastmcp): Use AsyncClient for SSE by alexander-alderman-webb in #5400
  • test(fastmcp): Use TestClient for Streamable HTTP by alexander-alderman-webb in #5384
  • test(fastmcp): Simulate stdio transport with memory streams by alexander-alderman-webb in #5333

Mcp

  • test(mcp): Use AsyncClient for SSE by alexander-alderman-webb in #5396
  • test(mcp): Use TestClient for Streamable HTTP by alexander-alderman-webb in #5383
  • test(mcp): Remove unused stdio helpers by alexander-alderman-webb in #5409
  • test(mcp): Simulate stdio transport with memory streams by alexander-alderman-webb in #5329

Other

  • ci: migration to the new codecov action by MathurAditya724 in #5392

🤖 This preview updates automatically when you update the PR.

@alexander-alderman-webb alexander-alderman-webb changed the title test(mcp): Simulate stdio transport with memory streams test(fastmcp): Use AsyncClient for SSE Jan 30, 2026
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review January 30, 2026 13:07
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner January 30, 2026 13:07
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

🥔

Base automatically changed from webb/test-mcp-sse to master February 2, 2026 12:17
Copy link

@cursor cursor bot left a 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.

@alexander-alderman-webb alexander-alderman-webb merged commit 1566e62 into master Feb 2, 2026
153 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/test-fastmcp-sse branch February 2, 2026 12:47
if request.content:
request_body = await request.aread()

body_sender, body_receiver = create_memory_object_stream[bytes](0) # type: ignore
Copy link

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.

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