Skip to content
Merged
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
Binary file added data/misc/diff_missing_fill.nc
Binary file not shown.
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ def sample_cordex_path(data_dir: Path) -> Path:
)


@pytest.fixture
def sample_incoherent_encoding_path(data_dir: Path) -> Path:
"""Return path to a incoherent NetCDF file."""
return data_dir / "misc/diff_missing_fill.nc"


def pytest_configure(config):
"""Register custom markers."""
config.addinivalue_line(
Expand Down
19 changes: 19 additions & 0 deletions tests/test_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,25 @@ def test_xarray_open_with_freva_engine(self, sample_netcdf_path: Path):
assert isinstance(ds, xr.Dataset)
ds.close()

@pytest.mark.required_data
def test_decoding(self, sample_incoherent_encoding_path: Path):
with pytest.warns():
ds = xr.open_dataset(str(sample_incoherent_encoding_path), engine="prism")
assert isinstance(ds, xr.Dataset)
ds.close()

@pytest.mark.required_data
def test_not_decoding(self, sample_incoherent_encoding_path: Path):
import warnings

with warnings.catch_warnings():
warnings.simplefilter("error")
ds = xr.open_dataset(
str(sample_incoherent_encoding_path), engine="prism", decode_cf=False
)
assert isinstance(ds, xr.Dataset)
ds.close()


class TestCustomRegistry:
"""Tests for custom backend registration."""
Expand Down
Loading