Skip to content

Commit ab8f478

Browse files
committed
Fix style issues in SSE mount_path tests
Fix linting issues in the SSE mount_path tests: - Remove unused imports (pytest, Starlette, Mount, Route, UUID) - Remove unused variables (app, app2, transport) - Fix line length issues - Improve code organization and formatting These changes ensure the new tests conform to the project's style guidelines and pass both ruff format and ruff check.
1 parent e029139 commit ab8f478

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

tests/server/sse/test_sse_mount_path.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import pytest
2-
from starlette.applications import Starlette
3-
from starlette.routing import Mount, Route
4-
from urllib.parse import quote
5-
from uuid import UUID, uuid4
61
from unittest.mock import patch
2+
from urllib.parse import quote
3+
from uuid import uuid4
74

85
from mcp.server.fastmcp import FastMCP
96
from mcp.server.sse import SseServerTransport
@@ -33,8 +30,8 @@ def test_sse_transport_endpoint_formation(self):
3330
def test_fastmcp_sse_transport_integration(self):
3431
"""Test the integration between FastMCP and SseServerTransport with mount paths.
3532
36-
Verifies that FastMCP correctly generates normalized endpoints based on mount_path
37-
settings and passes them to the SseServerTransport.
33+
Verifies that FastMCP correctly generates normalized endpoints based on
34+
mount_path settings and passes them to the SseServerTransport.
3835
"""
3936
# Test cases with different mount path configurations
4037
test_cases = [
@@ -56,13 +53,13 @@ def test_fastmcp_sse_transport_integration(self):
5653
# Verify the normalized endpoint matches expectations
5754
assert normalized_endpoint == expected_endpoint
5855

59-
# Create app and verify mount_path setting is preserved or updated
60-
app = mcp.sse_app()
56+
# Verify mount_path setting is preserved
57+
mcp.sse_app()
6158
assert mcp.settings.mount_path == mount_path
6259

6360
# Test with direct mount_path parameter
6461
mcp2 = FastMCP()
65-
app2 = mcp2.sse_app(mount_path=mount_path)
62+
mcp2.sse_app(mount_path=mount_path)
6663

6764
# Verify the mount_path was correctly set in settings
6865
assert mcp2.settings.mount_path == mount_path
@@ -96,9 +93,6 @@ def test_sse_session_uri_construction(self):
9693

9794
with patch("uuid.uuid4", return_value=test_uuid):
9895
for endpoint, expected_encoded_prefix in test_cases:
99-
# Create SSE transport with the endpoint
100-
transport = SseServerTransport(endpoint)
101-
10296
# Manually construct the session_uri as done in connect_sse
10397
session_uri = f"{quote(endpoint)}?session_id={test_uuid.hex}"
10498

0 commit comments

Comments
 (0)