From c130d623d53af7b133c46e0abb64c78baa1d2a16 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 9 Apr 2026 11:36:40 +0200 Subject: [PATCH] opentelemetry-sdk: fix a couple of unbound variables in tests --- opentelemetry-sdk/tests/trace/test_trace.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/opentelemetry-sdk/tests/trace/test_trace.py b/opentelemetry-sdk/tests/trace/test_trace.py index d4ee490f39..2c6fdf3f92 100644 --- a/opentelemetry-sdk/tests/trace/test_trace.py +++ b/opentelemetry-sdk/tests/trace/test_trace.py @@ -2231,6 +2231,7 @@ def test_parent_child_span_exception(self): exception_type = exception.__class__.__name__ exception_message = exception.args[0] + child_span = None try: with tracer.start_as_current_span( "parent", @@ -2245,6 +2246,8 @@ def test_parent_child_span_exception(self): except Exception: # pylint: disable=broad-exception-caught pass + self.assertIsNotNone(child_span) + self.assertTrue(child_span.status.is_ok) self.assertIsNone(child_span.status.description) self.assertTupleEqual(child_span.events, ()) @@ -2275,6 +2278,7 @@ def test_child_parent_span_exception(self): exception = Exception("exception") + child_span = None try: with tracer.start_as_current_span( "parent", @@ -2290,6 +2294,8 @@ def test_child_parent_span_exception(self): except Exception: # pylint: disable=broad-exception-caught pass + self.assertIsNotNone(child_span) + self.assertTrue(child_span.status.is_ok) self.assertIsNone(child_span.status.description) self.assertTupleEqual(child_span.events, ())