fix: ensure `ZipStore` is open before acquiring lock
Fix a bug where ZipStore complains that it has no attribute _lock when some methods are called. Any method using the lock should make sure the store is opened because that's when the _lock attribute gets set.
Codecov Report
:x: Patch coverage is 50.00000% with 6 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 59.14%. Comparing base (e456b09) to head (2aa6e14).
:warning: Report is 1 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/zarr/storage/_zip.py | 50.00% | 6 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #3593 +/- ##
==========================================
- Coverage 59.15% 59.14% -0.02%
==========================================
Files 86 86
Lines 10170 10182 +12
==========================================
+ Hits 6016 6022 +6
- Misses 4154 4160 +6
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/zarr/storage/_zip.py | 70.39% <50.00%> (-1.47%) |
:arrow_down: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
how did the bug you are fixing here get past the store tests? Maybe we need to make those tests stronger?
You're right, I didn't want to appear presumptuous but the code could do with some refactoring as well, having to repeat all those _sync_open calls in so many functions naturally increases the probability of forgetting some. Not sure if this should be done in this PR though.
if you can find a clean way to reduce the repetition (e.g., a decorator) we'd appreciate it!
@d-v-b just for info, I'm currently on holiday but I'm planning to implement the proposed improvements shortly