Skip to content

Commit db2d295

Browse files
committed
Temporarily suppress cleanup warnings to handle other tests
1 parent 9ce04f9 commit db2d295

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tests/client/test_session_tasks.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
from mcp.server import Server
1010
from mcp.shared.memory import create_client_server_memory_streams
1111

12+
# Mark all tests in this module to ignore memory stream cleanup warnings
13+
# These occur with tg.cancel_scope.cancel() pattern, same as SDK's own
14+
# create_connected_server_and_client_session in src/mcp/shared/memory.py
15+
pytestmark = pytest.mark.filterwarnings(
16+
"ignore:Exception ignored.*MemoryObject.*Stream:pytest.PytestUnraisableExceptionWarning"
17+
)
18+
1219

1320
@pytest.mark.anyio
1421
async def test_client_get_task_success():

tests/server/test_sse_security.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
from mcp.types import Tool
1919
from tests.test_helpers import wait_for_server
2020

21+
# Mark all tests in this module to ignore memory stream cleanup warnings
22+
# These occur with task group cancellation in SSE transport's connect_sse
23+
pytestmark = pytest.mark.filterwarnings(
24+
"ignore:Exception ignored.*MemoryObject.*Stream:pytest.PytestUnraisableExceptionWarning"
25+
)
26+
2127
logger = logging.getLogger(__name__)
2228
SERVER_NAME = "test_sse_security_server"
2329

0 commit comments

Comments
 (0)