fix(ci): use cargo-llvm-cov for Python SDK coverage#2817
Merged
Conversation
Python SDK is a native Rust extension, so switch from pytest-cov to cargo-llvm-cov following pydantic-core/PyO3 pattern.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2817 +/- ##
============================================
- Coverage 68.07% 67.57% -0.50%
Complexity 708 708
============================================
Files 1018 1027 +9
Lines 82550 83147 +597
Branches 60005 60015 +10
============================================
- Hits 56194 56188 -6
- Misses 24016 24608 +592
- Partials 2340 2351 +11
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Source llvm-cov env in same shell as build to ensure instrumentation
cargo-llvm-cov show-env uses RUSTC_WRAPPER not RUSTFLAGS, which maturin does not pass through. Use RUSTFLAGS and raw llvm tools.
mmodzelewski
approved these changes
Feb 26, 2026
hubcio
approved these changes
Feb 26, 2026
kriti-sc
pushed a commit
to kriti-sc/iggy
that referenced
this pull request
Mar 6, 2026
Co-authored-by: Maciej Modzelewski <maciej@modzelewski.dev>
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.

Which issue does this PR close?
Closes #2816
Rationale
The Python SDK is built with maturin/PyO3, meaning all business logic is compiled Rust. pytest-cov can only measure Python source, so it produced empty reports and the Codecov upload silently failed.
What changed?
pytest-cov was generating empty coverage reports because there is no Python source code to instrument in a native Rust extension.
Replaced pytest-cov with cargo-llvm-cov, which instruments the Rust code at build time and collects profiling data when Python tests call into the compiled .so. This follows the same pattern used by pydantic-core and PyO3 itself.
Local Execution
AI Usage