def test_func_span(): tracer = opentracing.tracer span = tracer.start_span(operation_name='parent') with span_in_context(span=span): with func_span('test') as child_span: assert span is child_span with func_span('test', tags={'x': 'y'}) as child_span: assert span is child_span
def test_func_span(): tracer = Tracer() span = tracer.start_trace(operation_name='parent') with RequestContextManager(span=span): with func_span('test') as child_span: assert span is child_span with func_span('test', tags={'x': 'y'}) as child_span: assert span is child_span
def test_func_span_without_parent(): with func_span('test', require_active_trace=False) as span: assert span is not None with func_span('test', require_active_trace=True) as span: assert span is None
def test_func_span_without_parent(): with func_span('test') as span: assert span is None