zarr-python icon indicating copy to clipboard operation
zarr-python copied to clipboard

[TST] Bring test coverage to 100%

Open jhamman opened this issue 1 year ago • 5 comments

As of today, Zarr-Python's main branch has a test coverage of 87%. We should strive to bring this back to 100%. Here is the current report:

❯ hatch env run --env test.py3.12-2.1-optional run-coverage
---------- coverage: platform darwin, python 3.12.8-final-0 ----------
Name                                   Stmts   Miss  Cover
----------------------------------------------------------
src/zarr/__init__.py                       7      0   100%
src/zarr/_compat.py                        6      0   100%
src/zarr/_version.py                      10      1    90%
src/zarr/abc/__init__.py                   0      0   100%
src/zarr/abc/codec.py                     71     11    85%
src/zarr/abc/metadata.py                  26      3    88%
src/zarr/abc/store.py                    129     21    84%
src/zarr/api/__init__.py                   0      0   100%
src/zarr/api/asynchronous.py             311     50    84%
src/zarr/api/synchronous.py               77     20    74%
src/zarr/codecs/__init__.py               10      0   100%
src/zarr/codecs/_v2.py                    51      6    88%
src/zarr/codecs/blosc.py                  99     15    85%
src/zarr/codecs/bytes.py                  68      8    88%
src/zarr/codecs/crc32c_.py                38      4    89%
src/zarr/codecs/gzip.py                   39      6    85%
src/zarr/codecs/sharding.py              325     40    88%
src/zarr/codecs/transpose.py              47      5    89%
src/zarr/codecs/vlen_utf8.py              71      4    94%
src/zarr/codecs/zstd.py                   56      8    86%
src/zarr/convenience.py                    4      4     0%
src/zarr/core/__init__.py                  3      0   100%
src/zarr/core/_info.py                    78      4    95%
src/zarr/core/_tree.py                    35     35     0%
src/zarr/core/array.py                   572     37    94%
src/zarr/core/array_spec.py               59      3    95%
src/zarr/core/attributes.py               29      7    76%
src/zarr/core/buffer/__init__.py           3      0   100%
src/zarr/core/buffer/core.py             126     27    79%
src/zarr/core/buffer/cpu.py               56      4    93%
src/zarr/core/buffer/gpu.py               75     43    43%
src/zarr/core/chunk_grids.py              69      8    88%
src/zarr/core/chunk_key_encodings.py      58     11    81%
src/zarr/core/codec_pipeline.py          111     10    91%
src/zarr/core/common.py                   84      9    89%
src/zarr/core/config.py                   15      0   100%
src/zarr/core/group.py                   676     51    92%
src/zarr/core/indexing.py                708     39    94%
src/zarr/core/metadata/__init__.py         7      0   100%
src/zarr/core/metadata/common.py           8      1    88%
src/zarr/core/metadata/v2.py             164     21    87%
src/zarr/core/metadata/v3.py             277     18    94%
src/zarr/core/strings.py                  35     10    71%
src/zarr/core/sync.py                     93      3    97%
src/zarr/creation.py                       4      4     0%
src/zarr/errors.py                        15      0   100%
src/zarr/registry.py                     103      8    92%
src/zarr/storage/__init__.py              18      1    94%
src/zarr/storage/_utils.py                36      2    94%
src/zarr/storage/common.py               176     35    80%
src/zarr/storage/fsspec.py               102     77    25%
src/zarr/storage/local.py                144     20    86%
src/zarr/storage/logging.py              139     53    62%
src/zarr/storage/memory.py               102     18    82%
src/zarr/storage/wrapper.py               80     35    56%
src/zarr/storage/zip.py                  152      6    96%
src/zarr/testing/__init__.py               7      1    86%
src/zarr/testing/buffer.py                33      2    94%
src/zarr/testing/stateful.py             213      6    97%
src/zarr/testing/store.py                210     17    92%
src/zarr/testing/strategies.py            35      0   100%
src/zarr/testing/utils.py                 25      4    84%
----------------------------------------------------------
TOTAL                                   6380    836    87%

jhamman avatar Jan 01 '25 22:01 jhamman

Test coverage is now being tracked on Codecov -- https://app.codecov.io/gh/zarr-developers/zarr-python/tree/main

Marking this as "Help Wanted" to start soliciting contributions to fill in test gaps.

jhamman avatar Jan 10 '25 17:01 jhamman

I'm working a bit on the storage related testing. I expect these can all be addressed in a single coherent PR, but please let me know if you'd rather smaller PRs bringing addressing each module separately.

src/zarr/abc/store.py                    129     21    84%
src/zarr/storage/__init__.py              18      1    94%
src/zarr/storage/_utils.py                36      2    94%
src/zarr/storage/common.py               176     35    80%
src/zarr/storage/fsspec.py               102     77    25%
src/zarr/storage/local.py                144     20    86%
src/zarr/storage/logging.py              139     53    62%
src/zarr/storage/memory.py               102     18    82%
src/zarr/storage/wrapper.py               80     35    56%
src/zarr/storage/zip.py                  152      6    96%
src/zarr/testing/store.py                210     17    92%

maxrjones avatar Jan 11 '25 15:01 maxrjones

that's great to hear @maxrjones -- I was also working on expanding store tests in #2447, but that PR is super outdated by now. nonetheless it might be helpful to see some of the changes I made to test fixtures, namely pulling the fsspec stuff into the main set of store fixtures

d-v-b avatar Jan 11 '25 15:01 d-v-b

that's great to hear @maxrjones -- I was also working on expanding store tests in #2447, but that PR is super outdated by now. nonetheless it might be helpful to see some of the changes I made to test fixtures, namely pulling the fsspec stuff into the main set of store fixtures

Oh nice, I didn't see that so thanks for sharing! would you rather update/continue that PR rather than review a different one? I don't want to spend time where it's not necessary.

maxrjones avatar Jan 11 '25 15:01 maxrjones

it's been a while since I worked on that PR, and I don't have time to keep working on it at the moment, so it's very likely that bringing it up to date will be a lot of work. If you think the merge conflicts aren't too bad, then it might save you some time to build on it, but otherwise I would just use it as an example of a similar effort, and you should feel free to copy + paste stuff from it as needed.

d-v-b avatar Jan 11 '25 15:01 d-v-b