Skip to content

feat(crc32c): add unit and cover nox sessions - #18424

Open
ohmayr wants to merge 7 commits into
mainfrom
crc32c-add-nox-sessions
Open

ohmayr wants to merge 7 commits into
mainfrom
crc32c-add-nox-sessions

Conversation

@ohmayr

@ohmayr ohmayr commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

feat: add unit and cover nox sessions and enforce 100% test coverage for google-crc32c

Fixes #17052

@ohmayr
ohmayr requested a review from a team as a code owner September 18, 2026 19:21

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request configures test coverage reporting for the google-crc32c package, setting a 100% coverage requirement, enabling unit tests in pure Python mode, and handling missing C extensions during testing. The review feedback suggests using lowercase "# pragma: no cover" comments to ensure coverage.py correctly excludes lines, enabling parallel coverage tracking in .coveragerc to prevent parallel test runs from overwriting coverage data, and updating the cover session in noxfile.py to combine these parallel coverage files before generating the report.

Comment thread packages/google-crc32c/tests/test___init__.py
Comment thread packages/google-crc32c/.coveragerc
Comment thread packages/google-crc32c/noxfile.py
@daniel-sanche

Copy link
Copy Markdown
Contributor

It looks like the package is being passed over by the unit tests

@ohmayr
ohmayr marked this pull request as draft September 18, 2026 22:58
@ohmayr
ohmayr force-pushed the crc32c-add-nox-sessions branch from 2baf953 to 851f38f Compare September 19, 2026 04:56
@ohmayr

ohmayr commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

kokoro:force-run

@ohmayr ohmayr added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 19, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 19, 2026
Remove outdated TODO comments and specify technical rationale for skipping
core and prerelease dependency sessions.
@ohmayr
ohmayr marked this pull request as ready for review September 19, 2026 06:27
Configure PYTHONPATH to point directly to src/ and target coverage at
src/google_crc32c to avoid editable install issues. Add unit tests for
array checksums and CommonChecksum interface contract, document
omissions for Windows DLL helper and C extension wrapper in .coveragerc,
and annotate pure-Python C fallback import with pragma NO COVER.

Fixes #17052
Directly test array.array buffer updating against the python Checksum
implementation instead of the parameterized _crc32c fixture, avoiding
TypeError when executed against the C-extension on Kokoro runners.
@ohmayr

ohmayr commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Hi @daniel-sanche,

Thanks for pointing that out! The issue was that modern pip install -e . placed editable loader files into the virtualenv's site-packages, causing pytest coverage to measure site-packages or skip the repository's src/google_crc32c files.

We have updated noxfile.py to set PYTHONPATH = "src" and point coverage explicitly at --cov=src/google_crc32c. We also:

  1. Added unit test cases for array updates and the CommonChecksum interface contract.
  2. Documented exclusions in .coveragerc for the Windows-only DLL bootstrap (__config__.py) and the C extension wrapper (cext.py, which is tested in the wheel check session).
  3. Marked the compiled C-extension import fallback in __init__.py with # pragma: NO COVER.

Pure-Python unit tests and coverage now measure src/google_crc32c cleanly with 100% coverage, and Kokoro builds across Linux and macOS have passed.

@daniel-sanche daniel-sanche left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This branch has not been deployed

No deployments
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.

[monorepo] Add or update nox sessions for packages/google-crc32c/

3 participants