Skip to content

Commit 61fcbfe

Browse files
committed
fix(test): filter by message instead of total count in test_no_op_tracer_provider_warning
1 parent 3c56140 commit 61fcbfe

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/tracing/adapters/test_opentelemetry.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,14 @@ def test_no_op_tracer_provider_warning(self):
361361

362362
_adapter = OpenTelemetryAdapter()
363363

364-
self.assertEqual(len(w), 1)
365-
self.assertTrue(issubclass(w[0].category, UserWarning))
366-
self.assertIn("No OpenTelemetry TracerProvider configured", str(w[0].message))
367-
self.assertIn("Traces will not be exported", str(w[0].message))
364+
noop_warnings = [
365+
x
366+
for x in w
367+
if issubclass(x.category, UserWarning)
368+
and "No OpenTelemetry TracerProvider configured" in str(x.message)
369+
]
370+
self.assertEqual(len(noop_warnings), 1)
371+
self.assertIn("Traces will not be exported", str(noop_warnings[0].message))
368372

369373
def test_no_warnings_with_proper_configuration(self):
370374
"""Test that no warnings are issued when properly configured."""

0 commit comments

Comments
 (0)