Skip to content
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

Merged
merged 13 commits into from
Jan 31, 2025
Merged

Conversation

abarciauskas-bgse
Copy link

@abarciauskas-bgse abarciauskas-bgse commented Jan 31, 2025

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

@@ -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
Copy link
Author

@abarciauskas-bgse abarciauskas-bgse Jan 31, 2025

Choose a reason for hiding this comment

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

⚠️ This fixes a warning 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
Copy link
Author

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
Copy link
Author

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

fpath, # type: ignore[arg-type]
drop_variables=drop_variables,
group=group,
decode_times=decode_times,
)
) as ds:
Copy link
Author

Choose a reason for hiding this comment

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

⚠️ This fixes a RuntimeWarning: deallocating CachingFileManager ... but file is not already closed. This may indicate a bug warning

@@ -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
Copy link
Author

Choose a reason for hiding this comment

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

⚠️ Fixes FutureWarning: The return type of 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
Copy link
Author

@abarciauskas-bgse abarciauskas-bgse Jan 31, 2025

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 = (
Copy link
Author

Choose a reason for hiding this comment

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

❌ Fixes failing test

@abarciauskas-bgse
Copy link
Author

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.

@jsignell jsignell merged commit 77b1088 into jsignell:main-kerchunk Jan 31, 2025
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.

2 participants