Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Scope the M2M storage warning assertion (#5040)

nate nowack4cea71692197
diff --git a/tests/client/auth/test_client_credentials.py b/tests/client/auth/test_client_credentials.py
index 910870fb4..59a0c57cd 100644
--- a/tests/client/auth/test_client_credentials.py
+++ b/tests/client/auth/test_client_credentials.py
@@ -188,7 +188,9 @@ class TestClientCredentialsConstruction:
def test_in_memory_storage_does_not_warn(self):
"""M2M re-acquires tokens cheaply, so no in-memory storage warning."""
with warnings.catch_warnings():
- warnings.simplefilter("error")
+ warnings.filterwarnings(
+ "error", message="Using in-memory token storage", category=UserWarning
+ )
ClientCredentialsOAuthProvider(
SERVER_URL, client_id="cid", client_secret="secret"
)