Skip to content

Commit 8b41055

Browse files
authored
opentelemetry-sdk: fix a couple of unbound variables in tests (#5063)
1 parent 73d65fd commit 8b41055

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

opentelemetry-sdk/tests/trace/test_trace.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,6 +2231,7 @@ def test_parent_child_span_exception(self):
22312231
exception_type = exception.__class__.__name__
22322232
exception_message = exception.args[0]
22332233

2234+
child_span = None
22342235
try:
22352236
with tracer.start_as_current_span(
22362237
"parent",
@@ -2245,6 +2246,8 @@ def test_parent_child_span_exception(self):
22452246
except Exception: # pylint: disable=broad-exception-caught
22462247
pass
22472248

2249+
self.assertIsNotNone(child_span)
2250+
22482251
self.assertTrue(child_span.status.is_ok)
22492252
self.assertIsNone(child_span.status.description)
22502253
self.assertTupleEqual(child_span.events, ())
@@ -2275,6 +2278,7 @@ def test_child_parent_span_exception(self):
22752278

22762279
exception = Exception("exception")
22772280

2281+
child_span = None
22782282
try:
22792283
with tracer.start_as_current_span(
22802284
"parent",
@@ -2290,6 +2294,8 @@ def test_child_parent_span_exception(self):
22902294
except Exception: # pylint: disable=broad-exception-caught
22912295
pass
22922296

2297+
self.assertIsNotNone(child_span)
2298+
22932299
self.assertTrue(child_span.status.is_ok)
22942300
self.assertIsNone(child_span.status.description)
22952301
self.assertTupleEqual(child_span.events, ())

0 commit comments

Comments
 (0)