test(sensors): cover TracingSensor (distributed_tracing) 0% → 100%#733
Merged
Conversation
faust/sensors/distributed_tracing.py had no tests (0% coverage). Add a unit suite for TracingSensor exercising every callback and branch: message in/out (with and without trace-context headers), stream event in/out (parent span present/absent, stream_meta and stream_spans created vs reused), send initiated/completed/error (span present/absent), header injection (success, no-tracer, no-span, and the exception path), and session cleanup on stop. Drives the opentracing tracer/spans via mocks. Module coverage: 0% -> 100% (statements and branches). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HHPL4VFWQRQPpjR1gXSKyL
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #733 +/- ##
==========================================
+ Coverage 95.11% 96.02% +0.91%
==========================================
Files 104 104
Lines 11169 11169
Branches 1206 1206
==========================================
+ Hits 10623 10725 +102
+ Misses 452 350 -102
Partials 94 94 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wbarnha
enabled auto-merge
July 21, 2026 17:03
wbarnha
disabled auto-merge
July 21, 2026 17:07
wbarnha
enabled auto-merge
July 21, 2026 17:07
wbarnha
disabled auto-merge
July 21, 2026 17:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a unit-test suite for
faust/sensors/distributed_tracing.py, which had no tests at all (0% coverage — the single largest testable coverage gap onmaster).Coverage
faust/sensors/distributed_tracing.py: 0% → 100% (all 102 statements and all 30 branches). That's the biggest single-module coverage win available without new dependencies.Tests (
tests/unit/sensors/test_distributed_tracing.py, 24 cases)Exercises every
TracingSensorcallback and both sides of each branch, driving the opentracing tracer/spans through mocks:app_tracer/kafka_tracercached propertieson_message_in— with trace-context headers (extract +follows_from) and withouton_stream_event_in— parent span present/absent;stream_metaandstream_spanscreated fresh vs. reusedon_stream_event_out— span finished/popped, no-spans, and stream-not-presenton_message_out— span present/absenton_send_initiated— parent span present/absenton_send_completed— span present/absenton_send_error— error tag +log_kv+finish(exception=…), and no-spantrace_inject_headers— success, no-tracer, no-span, and the exception→Nonepathstop— closes aiohttp sessions, and the no-sessions pathon_threaded_producer_buffer_processedNotes
faust/contrib/sentry.py(needsraven/sentry_sdk) andfaust/stores/aerospike.py(needs theaerospikeclient). Those are worth a follow-up once their extras are added to the test matrix.test_datadog.pycollection errors in this environment are a local datadog-dep issue, not affected by this change.)🤖 Generated with Claude Code
Generated by Claude Code