-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ab/fix tests #1
Ab/fix tests #1
Conversation
.github/workflows/main.yml
Outdated
@@ -51,7 +51,7 @@ jobs: | |||
|
|||
- name: Running Tests | |||
run: | | |||
python -m pytest --run-network-tests --verbose --cov=virtualizarr --cov-report=xml | |||
python -m pytest --run-network-tests --verbose --cov-report=xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoverageWarning: --include is ignored because --source is set (include-ignored) self.warn("--include is ignored because --source is set", slug="include-ignored")
@@ -3,7 +3,7 @@ channels: | |||
- conda-forge | |||
- nodefaults | |||
dependencies: | |||
- xarray>=2024.10.0,<2025.0.0 | |||
- xarray>=2025.1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ This fixes the Group.create_array() got an unexpected keyword argument 'exists_ok'
test failure
conftest.py
Outdated
@pytest.fixture | ||
def netcdf4_file(tmp_path: Path) -> str: | ||
filepath = tmp_path / "air.nc" | ||
|
||
# Set up example xarray dataset | ||
with xr.tutorial.open_dataset("air_temperature") as ds: | ||
# Save it to disk as netCDF (in temporary directory) | ||
ds.to_netcdf(filepath, format="NETCDF4") | ||
air_encoding = ds["air"].encoding | ||
air_encoding["_FillValue"] = -9999 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a warning SerializationWarning: saving variable air with floating point data as an integer dtype without any _FillValue to use for NaNs
virtualizarr/readers/common.py
Outdated
fpath, # type: ignore[arg-type] | ||
drop_variables=drop_variables, | ||
group=group, | ||
decode_times=decode_times, | ||
) | ||
) as ds: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RuntimeWarning: deallocating CachingFileManager ... but file is not already closed. This may indicate a bug
warning
virtualizarr/tests/test_backend.py
Outdated
@@ -152,7 +152,7 @@ def test_cftime_index(tmpdir, hdf_backend): | |||
# TODO use xr.testing.assert_identical(vds.indexes, ds.indexes) instead once class supported by assertion comparison, see https://github.com/pydata/xarray/issues/5812 | |||
assert index_mappings_equal(vds.xindexes, ds.xindexes) | |||
assert list(ds.coords) == list(vds.coords) | |||
assert vds.dims == ds.dims | |||
assert vds.sizes == ds.sizes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dataset.dims
will be changed to return a set of dimension names in future, in order to be more consistent with DataArray.dims
. To access a mapping from dimension names to lengths, please use Dataset.sizes
.
@@ -42,7 +42,7 @@ def test_zarr_v3_metadata_conformance(tmpdir, vds_with_manifest_arrays: Dataset) | |||
assert isinstance(metadata["fill_value"], (bool, int, float, str, list)) | |||
assert ( | |||
isinstance(metadata["codecs"], list) | |||
and len(metadata["codecs"]) > 1 | |||
and len(metadata["codecs"]) == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Fixes failing test
@@ -58,7 +58,9 @@ def test_manifest_array_zarr_v2_normalized(self): | |||
|
|||
# Get codecs and verify | |||
actual_codecs = get_codecs(manifest_array, normalize_to_zarr_v3=True) | |||
expected_codecs = manifest_array.zarray._v3_codec_pipeline() | |||
expected_codecs = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Fixes failing test
I decided to reset some of the warnings so this PR is just changes to fix the tests. I'll work on a separate branch to fix warnings. |
This PR fixes tests
and some warnings. Would like to continue to fix as many warnings as possible.2 of the failed tests relate to how we're handling codecs. I'm not sure it's 100% correct but may be worth merging to work on refactoring our zarr array representation in a separate set of changes. Related PR: zarr-developers#175 (haven't looked closely at this yet)
@jsignell