File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,8 @@ def span_request(
173173 yield _NullSpan ()
174174 return
175175 tracer = _get_tracer ()
176- if tracer is None : # pragma: no cover
176+ if tracer is None :
177+ yield _NullSpan () # pragma: no cover
177178 return
178179 with tracer .start_as_current_span (name , kind = SpanKind .CLIENT ) as span : # type: ignore[arg-type]
179180 base_attrs : Dict [str , Any ] = dict (attributes or {})
Original file line number Diff line number Diff line change @@ -39,10 +39,22 @@ def test_incorrect_client_throws_exception(monkeypatch):
3939 with pytest .raises (ValueError ):
4040 Stream (api_key = "xxx" , api_secret = "xxx" , base_url = "ftp://example.com" )
4141
42+
4243def test_client_does_not_raise_exception_without_tracer (client : Stream , monkeypatch ):
4344 # Monkey patch _get_tracer to always return None
4445 from getstream .common import telemetry
45- monkeypatch .setattr (telemetry , '_get_tracer' , lambda : None )
46+
47+ monkeypatch .setattr (telemetry , "_get_tracer" , lambda : None )
48+
49+ response = client .get_app ()
50+ assert response .data is not None
51+
52+
53+ def test_client_works_with_no_otel (client : Stream , monkeypatch ):
54+ # Monkey patch _get_tracer to always return None
55+ from getstream .common import telemetry
56+
57+ monkeypatch .setattr (telemetry , "_HAS_OTEL" , False )
4658
4759 response = client .get_app ()
4860 assert response .data is not None
You can’t perform that action at this time.
0 commit comments