Skip to content

Conversation

dcherian
Copy link
Contributor

@dcherian dcherian commented Jun 20, 2025

Add actions to

  1. overwrite data with oindex
  2. read and compare a full array

[Description of PR]

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.rst
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

Add actions to
1. overwrite data with oindex
2. read and compare a full array
@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jun 20, 2025
@dcherian dcherian force-pushed the stateful-test-upgrades branch from 6883a0e to 6fa55f0 Compare June 20, 2025 17:42
Copy link

codecov bot commented Jul 9, 2025

Codecov Report

Attention: Patch coverage is 95.12195% with 2 lines in your changes missing coverage. Please review.

Project coverage is 94.76%. Comparing base (c1ce2fd) to head (140f527).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/zarr/testing/strategies.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3161      +/-   ##
==========================================
- Coverage   94.76%   94.76%   -0.01%     
==========================================
  Files          78       78              
  Lines        8672     8710      +38     
==========================================
+ Hits         8218     8254      +36     
- Misses        454      456       +2     
Files with missing lines Coverage Δ
src/zarr/testing/stateful.py 98.20% <100.00%> (+0.21%) ⬆️
src/zarr/testing/strategies.py 96.87% <50.00%> (-3.13%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dcherian
Copy link
Contributor Author

dcherian commented Jul 9, 2025

Nice not sure which PR ended up fixing this!

@d-v-b
Copy link
Contributor

d-v-b commented Jul 9, 2025

can you explain a bit more what's changing in this PR?

self.all_arrays.add(path)

@rule()
@with_frequency(0.25)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

from logs it seems like hypothesis was clearing the store quite frequently, so I'm reducing frequency here.

store=store,
fill_value=fill_value,
zarr_format=3,
dimension_names=data.draw(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixes an oversight where we were never setting dimension names on these arrays


@precondition(lambda self: bool(self.all_arrays))
@rule(data=st.data())
def overwrite_array_orthogonal_indexing(self, data: DataObject) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adds a new step modeling a user overwriting existing array data with .oindex

)


def v3_dtypes() -> st.SearchStrategy[np.dtype[Any]]:
Copy link
Contributor Author

@dcherian dcherian Jul 10, 2025

Choose a reason for hiding this comment

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

These are unnecessary now. I guess we could add DeprecationWarning asking the user to use zarr.testing.strategies.dtypes() instead. I can do this next week

name = draw(array_names)
attributes = draw(attrs)
zarr_format = draw(zarr_formats)
store = draw(stores, label="store")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just nicer logs.

npindexer = []
ndim = len(shape)
for axis, size in enumerate(shape):
val = draw(
Copy link
Contributor Author

@dcherian dcherian Jul 10, 2025

Choose a reason for hiding this comment

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

strategy now works for 0-D

st.none() | shard_shapes(shape=nparray.shape, chunk_shape=chunk_shape),
label="shard shape",
)
extra_kwargs["dimension_names"] = draw(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

again, i forgot to set dimension_names earlier



@pytest.mark.filterwarnings("ignore::zarr.core.dtype.common.UnstableSpecificationWarning")
@given(data=st.data(), zarr_format=zarr_formats)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed now that all dtypes are supported for both versions


@precondition(lambda self: bool(self.all_arrays))
@rule(data=st.data())
def check_array(self, data: DataObject) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

new check that asserts the model and the tested store have the same array data

Copy link
Contributor

@d-v-b d-v-b left a comment

Choose a reason for hiding this comment

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

thanks deepak!

@d-v-b d-v-b enabled auto-merge (squash) July 11, 2025 18:27
@d-v-b d-v-b merged commit 0f0563b into zarr-developers:main Jul 11, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs release notes Automatically applied to PRs which haven't added release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants