π The fast, Pythonic way to build MCP servers and clients.
fix: filter warnings by message in KEY_PREFIX test (#3549)
Jeremiah Lowina50dcd870508
diff --git a/tests/utilities/test_components.py b/tests/utilities/test_components.pyindex 39182d434..a42c9a1f7 100644--- a/tests/utilities/test_components.py+++ b/tests/utilities/test_components.py@@ -237,8 +237,10 @@ class TestKeyPrefix:class NoPrefix(FastMCPComponent):pass- assert len(w) == 1- assert "NoPrefix does not define KEY_PREFIX" in str(w[0].message)+ key_prefix_warnings = [+ x for x in w if "does not define KEY_PREFIX" in str(x.message)+ ]+ assert len(key_prefix_warnings) == 1def test_no_warning_when_key_prefix_defined(self):"""Test that subclassing with KEY_PREFIX does not emit a warning."""@@ -248,7 +250,10 @@ class TestKeyPrefix:class WithPrefix(FastMCPComponent):KEY_PREFIX = "custom"- assert len(w) == 0+ key_prefix_warnings = [+ x for x in w if "does not define KEY_PREFIX" in str(x.message)+ ]+ assert len(key_prefix_warnings) == 0assert WithPrefix.make_key("test") == "custom:test"