Skip to content

Fix flaky SSE tests: test_sse_client_basic_connection_mounted_app and test_request_context_isolation #1777

Description

@maxisbey

Initial Checks

Description

Two SSE tests in tests/shared/test_sse.py are flaky:

Affected tests:

  • test_sse_client_basic_connection_mounted_app (line 326)
  • test_request_context_isolation (line 462)

CI evidence: https://github.com/modelcontextprotocol/python-sdk/actions/runs/19330649603/job/55292600721?pr=1586

Test locations:

  • tests/shared/test_sse.py:326 - test_sse_client_basic_connection_mounted_app
  • tests/shared/test_sse.py:462 - test_request_context_isolation

Related Issues

Python & MCP Python SDK

Latest SDK version

AI Disclaimer

Activity

  1. added
    bugSomething isn't working
    P3Nice to haves, rare edge cases
    on Dec 11, 2025
  2. BabyChrist666 commented on Feb 17, 2026

    @BabyChrist666
    Contributor

    Opened a PR to fix this: #2073

    Two changes:

    1. Enhanced wait_for_server() with a two-stage readiness check — after TCP connect succeeds, it now makes an actual HTTP request to confirm the ASGI app is handling requests (not just that the port is open)
    2. Removed unreachable dead code after blocking server.run() calls in run_server() and run_mounted_server()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Nice to haves, rare edge casesbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions