11import mock
22import unittest
33
4- from flask import (Flask , request )
4+ from flask import (Flask , Response , request )
55import opentracing
66from opentracing .ext import tags
77from opentracing .mocktracer import MockTracer
@@ -27,32 +27,32 @@ def flush_spans(tcr):
2727
2828@app .route ('/test' )
2929def check_test_works ():
30- return 'Success'
30+ return Response ( 'Success' )
3131
3232
3333@app .route ('/another_test' )
3434@tracing .trace ('url' , 'url_rule' )
3535def decorated_fn ():
36- return 'Success again'
36+ return Response ( 'Success again' )
3737
3838
3939@app .route ('/another_test_simple' )
4040@tracing .trace ('query_string' , 'is_xhr' )
4141def decorated_fn_simple ():
42- return 'Success again'
42+ return Response ( 'Success again' )
4343
4444
4545@app .route ('/error_test' )
4646@tracing .trace ()
4747def decorated_fn_with_error ():
48- raise RuntimeError ('Should not happen ' )
48+ raise RuntimeError ('Intentional testing exception ' )
4949
5050
5151@app .route ('/decorated_child_span_test' )
5252@tracing .trace ()
5353def decorated_fn_with_child_span ():
5454 with tracing .tracer .start_active_span ('child' ):
55- return 'Success'
55+ return Response ( 'Success' )
5656
5757
5858@app .route ('/wire' )
@@ -93,7 +93,7 @@ def test_span_deletion(self):
9393 assert not tracing_deferred ._current_scopes
9494
9595 def test_span_tags (self ):
96- test_app .get ('/another_test_simple' )
96+ response = test_app .get ('/another_test_simple' )
9797
9898 spans = tracing ._tracer .finished_spans ()
9999 assert len (spans ) == 1
@@ -102,6 +102,7 @@ def test_span_tags(self):
102102 tags .HTTP_METHOD : 'GET' ,
103103 tags .SPAN_KIND : tags .SPAN_KIND_RPC_SERVER ,
104104 tags .HTTP_URL : 'http://localhost/another_test_simple' ,
105+ tags .HTTP_STATUS_CODE : response .status_code ,
105106 }
106107
107108 @flaky (max_runs = 5 )
0 commit comments