Skip to content

Commit 0dd1c66

Browse files
committed
fix: more accurately test for deprecated warning count
1 parent 3220ce6 commit 0dd1c66

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

sdk/python/tests/test_client.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,16 @@ def test_tappd_client_deprecated():
263263
with warnings.catch_warnings(record=True) as w:
264264
warnings.simplefilter("always")
265265
TappdClient()
266-
assert len(w) == 1
267-
assert issubclass(w[0].category, DeprecationWarning)
268-
assert "TappdClient is deprecated" in str(w[0].message)
266+
267+
# Filter for TappdClient deprecation warnings specifically
268+
tappd_warnings = [
269+
warning for warning in w
270+
if issubclass(warning.category, DeprecationWarning)
271+
and "TappdClient is deprecated" in str(warning.message)
272+
]
273+
274+
assert len(tappd_warnings) == 1
275+
assert "TappdClient is deprecated" in str(tappd_warnings[0].message)
269276

270277

271278
def test_tappd_client_derive_key_deprecated():
@@ -308,9 +315,16 @@ def test_async_tappd_client_deprecated():
308315
with warnings.catch_warnings(record=True) as w:
309316
warnings.simplefilter("always")
310317
AsyncTappdClient()
311-
assert len(w) == 1
312-
assert issubclass(w[0].category, DeprecationWarning)
313-
assert "AsyncTappdClient is deprecated" in str(w[0].message)
318+
319+
# Filter for AsyncTappdClient deprecation warnings specifically
320+
tappd_warnings = [
321+
warning for warning in w
322+
if issubclass(warning.category, DeprecationWarning)
323+
and "AsyncTappdClient is deprecated" in str(warning.message)
324+
]
325+
326+
assert len(tappd_warnings) == 1
327+
assert "AsyncTappdClient is deprecated" in str(tappd_warnings[0].message)
314328

315329

316330
@pytest.mark.asyncio

0 commit comments

Comments
 (0)