Skip to content

refactor: remove dead zarr<3 (has_zarr_v3) guards in tests - #11376

Merged
dcherian merged 2 commits into
pydata:mainfrom
mvanhorn:fix/11346-remove-zarr-v2-dead-code
Jun 5, 2026
Merged

refactor: remove dead zarr<3 (has_zarr_v3) guards in tests#11376
dcherian merged 2 commits into
pydata:mainfrom
mvanhorn:fix/11346-remove-zarr-v2-dead-code

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the now-dead zarr v2 test guards built on has_zarr_v3, which can no longer be false now that xarray requires zarr>=3.0.0.

Why

xarray's lower bound for zarr is now 3.0.0, so the has_zarr_v3 flag is always true whenever zarr is installed. The skipif(not has_zarr_v3, ...) decorators and if has_zarr_v3: branches built on it are dead code that can never take the false path. Issue #11346 asks to clear out these stale 2.x guards so the test suite stops carrying conditionals that no longer mean anything.

Description

Now that xarray's lower bound for zarr is 3.0.0, the has_zarr_v3 flag in xarray/tests/__init__.py is always true whenever zarr is installed, so the skipif(not has_zarr_v3, ...) decorators and if has_zarr_v3: branches built on it never take the false path. This removes those stale 2.x guards in test_backends.py and test_backends_datatree.py and collapses the conditional in xarray/tests/__init__.py, keeping the formerly-guarded bodies. The still-meaningful version gates has_zarr_v3_dtypes (3.1.0) and has_zarr_v3_async_oindex (3.1.2) are left untouched, per issue #11346.

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Claude

@dcherian
dcherian merged commit 4b22e98 into pydata:main Jun 5, 2026
43 checks passed
@welcome

welcome Bot commented Jun 5, 2026

Copy link
Copy Markdown

Congratulations on completing your first pull request! Welcome to Xarray! We are proud of you, and hope to see you again! celebration gif

@mvanhorn

mvanhorn commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the quick merge @dcherian! Nice to have the dead has_zarr_v3 guards out of the test suite.

@mvanhorn

Copy link
Copy Markdown
Contributor Author

Much appreciated, @dcherian. Good to see the dead zarr<3 guards gone from the tests.

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.

dead code that conditions on zarr<3

2 participants