File tree 2 files changed +27
-1
lines changed
src/opentelemetry/sdk/trace
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -524,7 +524,7 @@ def use_span(
524
524
)
525
525
)
526
526
527
- raise
527
+ raise
528
528
529
529
finally :
530
530
if end_on_exit :
Original file line number Diff line number Diff line change @@ -679,6 +679,32 @@ def error_status_test(context):
679
679
.start_as_current_span ("root" )
680
680
)
681
681
682
+ def test_override_error_status (self ):
683
+ def error_status_test (context ):
684
+ with self .assertRaises (AssertionError ):
685
+ with context as root :
686
+ root .set_status (
687
+ trace_api .status .Status (
688
+ StatusCanonicalCode .UNAVAILABLE ,
689
+ "Error: Unavailable" ,
690
+ )
691
+ )
692
+ raise AssertionError ("unknown" )
693
+
694
+ self .assertIs (
695
+ root .status .canonical_code , StatusCanonicalCode .UNAVAILABLE
696
+ )
697
+ self .assertEqual (root .status .description , "Error: Unavailable" )
698
+
699
+ error_status_test (
700
+ trace .TracerProvider ().get_tracer (__name__ ).start_span ("root" )
701
+ )
702
+ error_status_test (
703
+ trace .TracerProvider ()
704
+ .get_tracer (__name__ )
705
+ .start_as_current_span ("root" )
706
+ )
707
+
682
708
683
709
def span_event_start_fmt (span_processor_name , span_name ):
684
710
return span_processor_name + ":" + span_name + ":start"
You can’t perform that action at this time.
0 commit comments