Skip to content

Add code coverage reporting to CI#9

Merged
merlimat merged 2 commits intooxia-db:mainfrom
merlimat:add-coverage-reporting
Apr 16, 2026
Merged

Add code coverage reporting to CI#9
merlimat merged 2 commits intooxia-db:mainfrom
merlimat:add-coverage-reporting

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

Summary

  • Add pytest-cov to dev dependencies
  • Configure coverage in pyproject.toml: measure oxia package, omit generated proto files, show missing lines
  • Update CI workflow to run tests with --cov, upload coverage.xml as artifact, and post a coverage summary comment on PRs (via orgoro/coverage)
  • Add coverage.xml and htmlcov/ to .gitignore

Current coverage on main (measured locally):

Name                                     Stmts   Miss  Cover   Missing
----------------------------------------------------------------------
src/oxia/__init__.py                         3      0   100%
src/oxia/client.py                         178      5    97%   37, 85, 93, 133, 147
src/oxia/defs.py                            17      2    88%   44, 47
src/oxia/ex.py                              10      0   100%
src/oxia/internal/backoff.py                11      0   100%
src/oxia/internal/compare.py                30      0   100%
src/oxia/internal/connection_pool.py        16      0   100%
src/oxia/internal/notifications.py          73      9    88%   72-78, 105, 109
src/oxia/internal/oxia_container.py          8      0   100%
src/oxia/internal/sequence_updates.py       48      4    92%   41-42, 54, 57
src/oxia/internal/service_discovery.py      83      5    94%   31, 43, 80, 100, 107
src/oxia/internal/sessions.py              101      3    97%   110, 147-148
----------------------------------------------------------------------
TOTAL                                      579     28    97%

Test plan

  • uv run pytest --cov --cov-report=term-missing runs locally and prints the table
  • --cov-report=xml generates coverage.xml
  • CI workflow posts coverage comment on this PR once merged/run

- Add pytest-cov to dev dependencies
- Configure coverage in pyproject.toml: measure oxia package, omit
  generated proto files, show missing lines
- Update CI workflow to run tests with coverage, upload XML artifact,
  and post a coverage summary comment on PRs
- Add coverage.xml and htmlcov/ to .gitignore

Signed-off-by: Matteo Merli <mmerli@apache.org>
The orgoro/coverage action requires write access to pull-requests,
which is not available for fork PRs. Coverage is still visible in
the CI log (term-missing) and as a downloadable XML artifact.

Signed-off-by: Matteo Merli <mmerli@apache.org>
@merlimat merlimat force-pushed the add-coverage-reporting branch from 3425873 to 264f3d7 Compare April 16, 2026 01:26
@merlimat merlimat merged commit bd39fe9 into oxia-db:main Apr 16, 2026
2 checks passed
merlimat added a commit to merlimat/oxia-client-python that referenced this pull request Apr 16, 2026
…db#7, oxia-db#9)

Bug oxia-db#7: put() used `type(value) is str` (rejects str subclasses) and
`bytes(str(value), ...)` (redundant str()). Non-str/non-bytes values
were forwarded to protobuf, erroring deep in serialization.

Extracted _coerce_value(): isinstance checks, clear TypeError for
invalid types, str.encode() instead of redundant bytes(str(...)).

Bug oxia-db#9: `raise oxia.ex.KeyNotFound` (class) was inconsistent with
the rest of the file which uses `raise KeyNotFound()` (instance).
Both are legal Python but the instance form is conventional.

Bug oxia-db#10 (non-atomic assignment swap) was a false positive — the
existing _parse_assignments already holds self._lock during both the
clear and repopulate. Dropped from the fix list.

Signed-off-by: Matteo Merli <mmerli@apache.org>
merlimat added a commit to merlimat/oxia-client-python that referenced this pull request Apr 16, 2026
…db#7, oxia-db#9)

Bug oxia-db#7: put() used `type(value) is str` (rejects str subclasses) and
`bytes(str(value), ...)` (redundant str()). Non-str/non-bytes values
were forwarded to protobuf, erroring deep in serialization.

Extracted _coerce_value(): isinstance checks, clear TypeError for
invalid types, str.encode() instead of redundant bytes(str(...)).

Bug oxia-db#9: `raise oxia.ex.KeyNotFound` (class) was inconsistent with
the rest of the file which uses `raise KeyNotFound()` (instance).
Both are legal Python but the instance form is conventional.

Bug oxia-db#10 (non-atomic assignment swap) was a false positive — the
existing _parse_assignments already holds self._lock during both the
clear and repopulate. Dropped from the fix list.

Signed-off-by: Matteo Merli <mmerli@apache.org>
merlimat added a commit that referenced this pull request Apr 16, 2026
… (#19)

Bug #7: put() used `type(value) is str` (rejects str subclasses) and
`bytes(str(value), ...)` (redundant str()). Non-str/non-bytes values
were forwarded to protobuf, erroring deep in serialization.

Extracted _coerce_value(): isinstance checks, clear TypeError for
invalid types, str.encode() instead of redundant bytes(str(...)).

Bug #9: `raise oxia.ex.KeyNotFound` (class) was inconsistent with
the rest of the file which uses `raise KeyNotFound()` (instance).
Both are legal Python but the instance form is conventional.

Bug #10 (non-atomic assignment swap) was a false positive — the
existing _parse_assignments already holds self._lock during both the
clear and repopulate. Dropped from the fix list.

Signed-off-by: Matteo Merli <mmerli@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant