Skip to content

Conversation

@agriyakhetarpal
Copy link
Contributor

The tests test_err_location, test_repr, and test_backwards_compatibility were not reporting that they were skipped if the crc32c dependency wasn't available/installed, as they weren't marked with the appropriate markers. This PR skips these tests at the pytest level rather than using a has_crc32c check that defines the tests at collection. I've parametrized most of these tests. I had to split up the test_backwards_compatibility test into two, as CRC32C() wouldn't be defined if it were not installed (I don't think it makes sense to mock it just for one test).

Closes #640

TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

@codecov
Copy link

codecov bot commented Apr 15, 2025

Codecov Report

❌ Patch coverage is 86.20690% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.08%. Comparing base (fedb0cb) to head (1e394e7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
numcodecs/tests/test_checksum32.py 86.20% 4 Missing ⚠️

❌ Your patch status has failed because the patch coverage (86.20%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project status has failed because the head coverage (89.08%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #740      +/-   ##
==========================================
+ Coverage   89.00%   89.08%   +0.07%     
==========================================
  Files          64       64              
  Lines        2574     2574              
==========================================
+ Hits         2291     2293       +2     
+ Misses        283      281       -2     
Files with missing lines Coverage Δ
numcodecs/tests/test_checksum32.py 84.04% <86.20%> (+2.12%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@agriyakhetarpal
Copy link
Contributor Author

🤔 I'm not sure if the Codecov report makes sense here. I've just changed test_err_location to use if not has_crc32c and skip it instead of using if has_crc32c. It should mean the same thing.

@agriyakhetarpal
Copy link
Contributor Author

Thanks! I think the CodeCov report is spurious; these are test files and aren't missing coverage. I suppose they should be excluded.

@d-v-b
Copy link
Contributor

d-v-b commented Nov 20, 2025

yes i'm happy ignoring codecov here and fixing it in a separate effort. Thanks for this PR!

@d-v-b d-v-b merged commit cc005a4 into zarr-developers:main Nov 20, 2025
32 of 34 checks passed
@agriyakhetarpal agriyakhetarpal deleted the fix/raise-pytest-skips-on-crc32c branch November 20, 2025 13:48
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.

Explicitly pytest.skip any tests that depend on optional dependencies

2 participants