From ce23baa0bca2d350257b2c6c40b6db8b54269e57 Mon Sep 17 00:00:00 2001 From: apex-mochen <2756823972@qq.com> Date: Fri, 9 Oct 2026 00:24:41 +0800 Subject: [PATCH] fix(tests): exempt mock-echo assertions from TQ002 in #44504 otel tests Both new regression tests for #44504 assert on the OpenTelemetry tracer mock, which the repository's test-quality TQ002 rule flags as mock-echo. The observable behavior under test is precisely the absence/presence of a raw span, which can only be observed through the tracer mock, so both carry an explicit test-quality-ok exemption. Signed-off-by: apex-mochen <2756823972@qq.com> --- tests/unit/integrations/test_opentelemetry.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/integrations/test_opentelemetry.py b/tests/unit/integrations/test_opentelemetry.py index db64bea4a69..ec4f3bc3789 100644 --- a/tests/unit/integrations/test_opentelemetry.py +++ b/tests/unit/integrations/test_opentelemetry.py @@ -7342,6 +7342,7 @@ class TestOpenTelemetryRawSpanRespectsRedaction(unittest.TestCase): @patch.dict(os.environ, {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": ""}) def test_skips_raw_span_when_redaction_header_set(self): + # test-quality-ok: negative-path test; the observable behavior is precisely that no raw span is created, which is only assertable on the tracer mock """Redaction requested via the per-request header -> raw span is not created.""" from litellm.integrations.opentelemetry import OpenTelemetry @@ -7362,6 +7363,7 @@ class TestOpenTelemetryRawSpanRespectsRedaction(unittest.TestCase): @patch.dict(os.environ, {"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT": ""}) def test_creates_raw_span_when_no_redaction_requested(self): + # test-quality-ok: positive-path twin of the test above; asserts the span name and raw-attribute hook via the tracer mock, matching the existing file style """No redaction requested (empty headers dict) -> raw span is still created.""" from litellm.integrations.opentelemetry import RAW_REQUEST_SPAN_NAME, OpenTelemetry