def get_app(self):
     self.tracer = MockTracer()
     config.tracer = self.tracer
     config.trace_client = False
     instrument()
     self.app = tornado.web.Application([('/endpoint', Handler)])
     return self.app
 def test_instrument_uses_global_tracer_without_config_tracer(self):
     config.tracer = None
     with mock.patch('tornado.web.Application', MockApplication):
         instrument()
         app = MockApplication()
         assert app.settings.get(
             'opentracing_tracing').tracer is opentracing.tracer
 def test_instrument_tornado_values_set_by_config(self, trace_all, trace_client, traced_attributes, start_span_cb):
     tracer = MockTracer()
     config.tracer = tracer
     config.trace_all = trace_all
     config.trace_client = trace_client
     config.traced_attributes = traced_attributes
     config.start_span_cb = start_span_cb
     with mock.patch('tornado.web.Application', MockApplication):
         instrument()
         app = MockApplication('arg1', named_arg='arg2')
         assert app.settings.get('opentracing_trace_all') is trace_all
         assert app.settings.get('opentracing_trace_client') is trace_client
         assert app.settings.get('opentracing_traced_attributes') is traced_attributes
         assert app.settings.get('opentracing_start_span_cb') is start_span_cb
         assert app.settings.get('opentracing_tracing').tracer is tracer
 def get_app(self):
     self.tracer = MockTracer()
     config.tracer = self.tracer
     instrument()
     return tornado.web.Application([('/endpoint', Handler)])