def _storage(self): return thread_local.get_thread_local_zipkin_attrs()
def test_get_thread_local_zipkin_attrs_creates_empty_list_if_not_attached(): delattr(thread_local._thread_local, "zipkin_attrs") assert not hasattr(thread_local._thread_local, "zipkin_attrs") assert thread_local.get_thread_local_zipkin_attrs() == [] assert hasattr(thread_local._thread_local, "zipkin_attrs")
def test_get_thread_local_zipkin_attrs_returns_back_zipkin_attrs_if_present(): assert thread_local.get_thread_local_zipkin_attrs() == ['foo']
def test_get_thread_local_zipkin_attrs_returns_back_zipkin_attrs_if_present(): tracer = storage.get_default_tracer() with mock.patch.object(tracer._context_stack, "_storage", ["foo"]): assert thread_local.get_thread_local_zipkin_attrs() == ["foo"]