File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
src/opentelemetry/sdk/trace Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -524,7 +524,7 @@ def use_span(
524524 )
525525 )
526526
527- raise
527+ raise
528528
529529 finally :
530530 if end_on_exit :
Original file line number Diff line number Diff line change @@ -679,6 +679,32 @@ def error_status_test(context):
679679 .start_as_current_span ("root" )
680680 )
681681
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+
682708
683709def span_event_start_fmt (span_processor_name , span_name ):
684710 return span_processor_name + ":" + span_name + ":start"
You can’t perform that action at this time.
0 commit comments