fix: filter warnings by message in KEY_PREFIX test (#3549)

This commit is contained in:
Jeremiah Lowin 2026-03-18 11:33:19 -04:00 committed by GitHub
commit a50dcd8705
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) == 1
def 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) == 0
assert WithPrefix.make_key("test") == "custom:test"