Skip to content

Commit 9009cad

Browse files
authored
chore: give every coverage pragma a reason (TS6, TS5) (#261)
1 parent b50861e commit 9009cad

5 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎lite_bootstrap/instruments/logging_instrument.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def tracer_injection(_: "WrappedLogger", __: str, event_dict: "EventDict") -> "E
4747
}
4848
return event_dict
4949

50-
else: # pragma: no cover
50+
else: # pragma: no cover - only without opentelemetry, i.e. neither the [otl] nor the [otl-http] extra
5151

5252
def tracer_injection(_: "WrappedLogger", __: str, event_dict: "EventDict") -> "EventDict":
5353
return event_dict

‎lite_bootstrap/instruments/opentelemetry_instrument.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def on_end(self, span: "ReadableSpan") -> None:
126126
pyroscope.remove_thread_tag(_PYROSCOPE_SPAN_ID_KEY, format_span_id(span.context.span_id))
127127
pyroscope.remove_thread_tag(_PYROSCOPE_SPAN_NAME_KEY, span.name)
128128

129-
def force_flush(self, timeout_millis: int = 30000) -> bool: # pragma: no cover # noqa: ARG002
129+
def force_flush(self, timeout_millis: int = 30000) -> bool: # noqa: ARG002
130130
return True
131131

132132

‎pyproject.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,5 +267,4 @@ asyncio_default_fixture_loop_scope = "function"
267267
fail_under = 100
268268
exclude_also = [
269269
"if typing.TYPE_CHECKING:",
270-
"except ImportError:"
271270
]

‎tests/instruments/test_pyroscope_instrument.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ def test_pyroscope_span_processor_on_start_remote_parent() -> None:
175175
mock_pyroscope.add_thread_tag.assert_any_call("span_name", "remote-root")
176176

177177

178+
def test_pyroscope_span_processor_does_not_fail_provider_force_flush() -> None:
179+
provider = SDKTracerProvider()
180+
provider.add_span_processor(otel_module.PyroscopeSpanProcessor())
181+
assert provider.force_flush() is True
182+
183+
178184
def test_pyroscope_otel_adds_span_processor_when_configured() -> None:
179185
"""OTel instrument adds PyroscopeSpanProcessor when pyroscope_endpoint is set."""
180186
config = FreeConfig(

‎tests/test_litestar_bootstrap.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def test_litestar_otel_apps_cache_evicts_dead_refs() -> None:
258258
)
259259

260260
async def transient_app(scope: dict, receive: object, send: object) -> None: # noqa: ARG001
261-
return None # pragma: no cover
261+
return None # pragma: no cover - only a weakref target; the test never calls it
262262

263263
weak_app = weakref.ref(transient_app)
264264
middleware._otel_apps[transient_app] = "marker" # noqa: SLF001 # ty: ignore[invalid-assignment]

0 commit comments

Comments
 (0)