From 09e0b0f8069554d03da842f708763706dbb8fc69 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Tue, 21 Oct 2025 20:30:13 -0500 Subject: [PATCH 1/3] ci: add paths filter to pull_request test trigger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit only run tests when relevant files change (src/, tests/, uv.lock, pyproject.toml, .github/workflows/) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/run-tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 29c024e86..5296c354f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,8 +14,13 @@ on: - "pyproject.toml" - ".github/workflows/**" - # run on all pull requests because these checks are required and will block merges otherwise pull_request: + paths: + - "src/**" + - "tests/**" + - "uv.lock" + - "pyproject.toml" + - ".github/workflows/**" workflow_dispatch: From c73b19eaaf2037059352c9af9faaac66a23e6163 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Tue, 21 Oct 2025 20:32:07 -0500 Subject: [PATCH 2/3] test: acknowledge expected warnings in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - deprecation warning for sse_app method in test_sse.py - in-memory token storage warning in oauth client tests instead of suppressing warnings in pytest config, explicitly assert that expected warnings are raised. this validates that the warnings are working as intended. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tests/client/auth/test_oauth_client.py | 13 +++++++++---- tests/client/test_sse.py | 7 ++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/client/auth/test_oauth_client.py b/tests/client/auth/test_oauth_client.py index dbf41dd0b..18fb66da8 100644 --- a/tests/client/auth/test_oauth_client.py +++ b/tests/client/auth/test_oauth_client.py @@ -52,10 +52,15 @@ def client_unauthorized(streamable_http_server: str) -> Client: @pytest.fixture def client_with_headless_oauth(streamable_http_server: str) -> Client: """Client with headless OAuth that bypasses browser interaction.""" - return Client( - transport=StreamableHttpTransport(streamable_http_server), - auth=HeadlessOAuth(mcp_url=streamable_http_server), - ) + # Expect warning about in-memory token storage + with pytest.warns( + UserWarning, + match="Using in-memory token storage is not recommended for production use", + ): + return Client( + transport=StreamableHttpTransport(streamable_http_server), + auth=HeadlessOAuth(mcp_url=streamable_http_server), + ) async def test_unauthorized(client_unauthorized: Client): diff --git a/tests/client/test_sse.py b/tests/client/test_sse.py index 914b505a2..8c0e69cac 100644 --- a/tests/client/test_sse.py +++ b/tests/client/test_sse.py @@ -97,7 +97,12 @@ async def nested_sse_server(): from fastmcp.utilities.http import find_available_port server = create_test_server() - sse_app = server.sse_app(path="/mcp/sse/", message_path="/mcp/messages") + # Expect deprecation warning for sse_app method + with pytest.warns( + DeprecationWarning, + match="The sse_app method is deprecated .* Use http_app as a modern .* alternative", + ): + sse_app = server.sse_app(path="/mcp/sse/", message_path="/mcp/messages") # Nest the app under multiple mounts to test URL resolution inner = Starlette(routes=[Mount("/nest-inner", app=sse_app)]) From 46da3fa2bdc00c3ffcfe75a86700f9f21d88d6ad Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Tue, 21 Oct 2025 20:32:56 -0500 Subject: [PATCH 3/3] test: acknowledge oauth in-memory storage warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add pytest.warns assertions for remaining OAuth tests that trigger the in-memory token storage warning in test_client.py and test_mcp_config.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- tests/client/test_client.py | 42 ++++++++++++++++++++++++++++++------- tests/test_mcp_config.py | 7 ++++++- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/tests/client/test_client.py b/tests/client/test_client.py index a32e92073..e47b15260 100644 --- a/tests/client/test_client.py +++ b/tests/client/test_client.py @@ -968,26 +968,52 @@ def test_stdio_doesnt_support_auth(self): Client(transport=StdioTransport("echo", ["hello"]), auth="oauth") def test_oauth_literal_sets_up_oauth_shttp(self): - client = Client( - transport=StreamableHttpTransport("http://localhost:8000"), auth="oauth" - ) + # Expect warning about in-memory token storage + with pytest.warns( + UserWarning, + match="Using in-memory token storage is not recommended for production use", + ): + client = Client( + transport=StreamableHttpTransport("http://localhost:8000"), auth="oauth" + ) assert isinstance(client.transport, StreamableHttpTransport) assert isinstance(client.transport.auth, OAuthClientProvider) def test_oauth_literal_pass_direct_to_transport(self): - client = Client( - transport=StreamableHttpTransport("http://localhost:8000", auth="oauth"), - ) + # Expect warning about in-memory token storage + with pytest.warns( + UserWarning, + match="Using in-memory token storage is not recommended for production use", + ): + client = Client( + transport=StreamableHttpTransport( + "http://localhost:8000", auth="oauth" + ), + ) assert isinstance(client.transport, StreamableHttpTransport) assert isinstance(client.transport.auth, OAuthClientProvider) def test_oauth_literal_sets_up_oauth_sse(self): - client = Client(transport=SSETransport("http://localhost:8000"), auth="oauth") + # Expect warning about in-memory token storage + with pytest.warns( + UserWarning, + match="Using in-memory token storage is not recommended for production use", + ): + client = Client( + transport=SSETransport("http://localhost:8000"), auth="oauth" + ) assert isinstance(client.transport, SSETransport) assert isinstance(client.transport.auth, OAuthClientProvider) def test_oauth_literal_pass_direct_to_transport_sse(self): - client = Client(transport=SSETransport("http://localhost:8000", auth="oauth")) + # Expect warning about in-memory token storage + with pytest.warns( + UserWarning, + match="Using in-memory token storage is not recommended for production use", + ): + client = Client( + transport=SSETransport("http://localhost:8000", auth="oauth") + ) assert isinstance(client.transport, SSETransport) assert isinstance(client.transport.auth, OAuthClientProvider) diff --git a/tests/test_mcp_config.py b/tests/test_mcp_config.py index d0cac215e..f1f9eb564 100644 --- a/tests/test_mcp_config.py +++ b/tests/test_mcp_config.py @@ -461,7 +461,12 @@ async def test_remote_config_with_oauth_literal(): } } } - client = Client(config) + # Expect warning about in-memory token storage + with pytest.warns( + UserWarning, + match="Using in-memory token storage is not recommended for production use", + ): + client = Client(config) assert isinstance(client.transport.transport, StreamableHttpTransport) assert isinstance(client.transport.transport.auth, OAuthClientProvider)