Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/3977.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix flaky stateful test bookkeeping when `delete_dir` matches string prefixes instead of true directory descendants. Previously a path such as `6/faNT…` could be incorrectly removed when deleting `6/f`. (See [issue #3977](https://github.com/zarr-developers/zarr-python/issues/3977).)
2 changes: 1 addition & 1 deletion src/zarr/testing/stateful.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def delete_dir(self, data: DataObject) -> None:

matches = set()
for node in self.all_groups | self.all_arrays:
if node.startswith(path):
if node == path or node.startswith(path + "/"):
matches.add(node)
self.all_groups = self.all_groups - matches
self.all_arrays = self.all_arrays - matches
Expand Down
2 changes: 2 additions & 0 deletions tests/test_store/test_stateful.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ def mk_test_instance_sync() -> ZarrStoreStateMachine:
# But LocalStore, directories can hang around even after a key is delete-d.
pytest.skip(reason="Test isn't suitable for LocalStore.")
run_state_machine_as_test(mk_test_instance_sync) # type: ignore[no-untyped-call]


Loading