Skip to content

Use pytest.skipif to properly report skipped CRC32C codec tests #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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)

Copy link

codecov bot commented Apr 15, 2025

Codecov Report

Attention: Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.92%. Comparing base (3438e16) to head (774bade).

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

❌ Your patch check has failed because the patch coverage (96.55%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #740      +/-   ##
==========================================
- Coverage   99.96%   99.92%   -0.04%     
==========================================
  Files          63       63              
  Lines        2736     2736              
==========================================
- Hits         2735     2734       -1     
- Misses          1        2       +1     
Files with missing lines Coverage Δ
numcodecs/tests/test_checksum32.py 98.82% <96.55%> (-1.18%) ⬇️
🚀 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.

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
1 participant