Add code coverage measurement with Codecov integration#837
Merged
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Measure coverage of the `ydb` package via pytest-cov and report it to Codecov with separate unit/integration flags. - pyproject.toml: coverage config (branch coverage, source=ydb), omitting the auto-generated _grpc/v3..v6 stubs, *_test.py files, and the legacy dbapi/sqlalchemy packages. - tox.ini: new `cov` env producing term/html/xml reports. - tests.yaml: dedicated `coverage` job (Python 3.12) running the unit and integration suites and uploading both to Codecov. - .github/codecov.yml: PR gate — overall project coverage may not drop by more than 1%, and new code in the diff must be >= 80% covered. - README: Codecov badge. The coverage job sets COVERAGE_CORE=sysmon (PEP 669) so the low-overhead tracer keeps the timing-sensitive chaos tests (which kill and restart YDB) passing under instrumentation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
681686e to
1ac6374
Compare
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.
Summary
Introduces code coverage measurement for the
ydbpackage and wires it to Codecov with a PR gate.pytest-cov(coverage.py) — branch coverage,source=ydb. Auto-generated_grpc/v3..v6stubs and*_test.pyfiles are excluded; the hand-written_grpc/grpcwrapper/*(topic reader/writer logic) stays measured.covenv —tox -e cov -- ydb/tox -e cov -- tests, producing term/html/xml reports.coveragejob (Python 3.12) that runs the unit and integration suites and uploads both to Codecov withunit/integrationflags (Codecov merges them)..github/codecov.yml):projectcoverage may not drop by more than 1%; new code in the diff (patch) must be ≥ 80% covered.Baseline
Local combined run: unit + integration = 81% (605 passed, 18 pre-existing skips). Topic internals are well covered (reader/writer asyncio ~90%,
grpcwrapper/ydb_topic.py87%).Note on
COVERAGE_CORE=sysmonThe coverage job uses the PEP 669
sys.monitoringbackend. The default C tracer's overhead breaks the timing-sensitive chaos tests (e.g.test_no_session_leakdoesacquire(timeout=0.5)then asserts pool state and only restarts YDB after the assert — under tracer slowdown the assert fails, YDB stays down, and the rest of the suite cascades).sysmonkeeps overhead low so these pass. It requires Python 3.12+, which is why coverage is collected on a single 3.12 job rather than across the whole matrix.Follow-up (after this PR runs green)
Add
codecov/projectandcodecov/patchas required status checks inmainbranch protection to make the gate blocking.🤖 Generated with Claude Code