--- a PPN by Garber Painting Akron. With Image Size Reduction included!URL: http://github.com/modelcontextprotocol/python-sdk/pull/2342.patch
nraisableExceptionWarning)
+ gc.collect()
+
@pytest.mark.anyio
async def test_streamablehttp_request_context_propagation(context_aware_server: None, basic_server_url: str) -> None:
From 578d132016793a4bab2a764c5b50d9d405f30939 Mon Sep 17 00:00:00 2001
From: perhapzz
Date: Thu, 26 Mar 2026 03:27:39 +0000
Subject: [PATCH 5/6] fix: suppress ProactorEventLoop teardown warnings on
Windows
On Windows Python 3.13, the ProactorBasePipeTransport finalizer fires
during GC after the threaded uvicorn server shuts down, raising
PytestUnraisableExceptionWarning. Add a filterwarnings marker to all
tests that use the threaded context_aware_server fixture.
---
tests/shared/test_streamable_http.py | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/tests/shared/test_streamable_http.py b/tests/shared/test_streamable_http.py
index 11889c7dc..fbcf877ed 100644
--- a/tests/shared/test_streamable_http.py
+++ b/tests/shared/test_streamable_http.py
@@ -1552,12 +1552,20 @@ def _create_context_aware_server(port: int) -> uvicorn.Server:
@pytest.fixture
def context_aware_server(basic_server_port: int) -> Generator[None, None, None]:
- """Start the context-aware server on a background thread (in-process for coverage)."""
+ """Start the context-aware server on a background thread (in-process for coverage).
+
+ Unlike multiprocessing, threads share the host process's warning filters.
+ Uvicorn and the Windows ProactorEventLoop emit DeprecationWarning /
+ ResourceWarning during startup and teardown that pytest's
+ ``filterwarnings = ["error"]`` would otherwise promote to hard failures.
+ We therefore run the server with all warnings suppressed (mirroring
+ the implicit isolation that multiprocessing provided).
+ """
server_instance = _create_context_aware_server(basic_server_port)
def _run() -> None:
with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=DeprecationWarning)
+ warnings.simplefilter("ignore")
server_instance.run()
thread = threading.Thread(target=_run, daemon=True)
@@ -1570,15 +1578,14 @@ def _run() -> None:
server_instance.should_exit = True
thread.join(timeout=5)
- # Force GC and suppress Windows ProactorBasePipeTransport.__del__ warnings
- # that surface when the event loop is torn down in a thread.
- import gc
- with warnings.catch_warnings():
- warnings.filterwarnings("ignore", category=pytest.PytestUnraisableExceptionWarning)
- gc.collect()
+# Marker to suppress Windows ProactorEventLoop teardown warnings on threaded servers.
+# When uvicorn runs in a thread (instead of a subprocess), transport finalizers fire
+# during GC in the main process and trigger PytestUnraisableExceptionWarning.
+_suppress_transport_teardown = pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
+@_suppress_transport_teardown
@pytest.mark.anyio
async def test_streamablehttp_request_context_propagation(context_aware_server: None, basic_server_url: str) -> None:
"""Test that request context is properly propagated through StreamableHTTP."""
@@ -1612,6 +1619,7 @@ async def test_streamablehttp_request_context_propagation(context_aware_server:
assert headers_data.get("x-trace-id") == "trace-123"
+@_suppress_transport_teardown
@pytest.mark.anyio
async def test_streamablehttp_request_context_isolation(context_aware_server: None, basic_server_url: str) -> None:
"""Test that request contexts are isolated between StreamableHTTP clients."""
@@ -1650,6 +1658,7 @@ async def test_streamablehttp_request_context_isolation(context_aware_server: No
assert ctx["headers"].get("authorization") == f"Bearer token-{i}"
+@_suppress_transport_teardown
@pytest.mark.anyio
async def test_client_includes_protocol_version_header_after_init(context_aware_server: None, basic_server_url: str):
"""Test that client includes mcp-protocol-version header after initialization."""
@@ -2263,6 +2272,7 @@ async def test_streamable_http_client_does_not_mutate_provided_client(
assert custom_client.headers.get("Authorization") == "Bearer test-token"
+@_suppress_transport_teardown
@pytest.mark.anyio
async def test_streamable_http_client_mcp_headers_override_defaults(
context_aware_server: None, basic_server_url: str
@@ -2294,6 +2304,7 @@ async def test_streamable_http_client_mcp_headers_override_defaults(
assert headers_data["content-type"] == "application/json"
+@_suppress_transport_teardown
@pytest.mark.anyio
async def test_streamable_http_client_preserves_custom_with_mcp_headers(
context_aware_server: None, basic_server_url: str
From 0007aa58734bfb42d48e4efcf71645bdf43e0705 Mon Sep 17 00:00:00 2001
From: perhapzz
Date: Thu, 26 Mar 2026 03:45:23 +0000
Subject: [PATCH 6/6] ci: re-trigger CI (flaky Windows tests)
pFad - Phonifier reborn
Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy