Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Jan 13, 2024
1 parent 278026b commit 46fd968
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 142 deletions.
9 changes: 8 additions & 1 deletion tests/test_manage.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import tempfile

from pytest import fixture, mark, param, raises
from pytest import fixture, mark, param, raises, importorskip
import numpy as np
import xarray as xr

Expand Down Expand Up @@ -71,6 +71,8 @@ class TestSaveAndLoad:
param('netcdf4', 'h5netcdf', marks=mark.xfail),
param('netcdf4', 'netcdf4', marks=mark.xfail)])
def test_io_only_real(self, ds_real, engine_save, engine_load):
importorskip(engine_save)
importorskip(engine_load)
with tempfile.TemporaryDirectory() as tmpdir:
save_ds(ds_real, os.path.join(tmpdir, "test.h5"),
engine=engine_save)
Expand All @@ -85,6 +87,9 @@ def test_io_only_real(self, ds_real, engine_save, engine_load):
param('netcdf4', 'h5netcdf', marks=mark.xfail),
param('netcdf4', 'netcdf4', marks=mark.xfail)])
def test_io_complex_data(self, ds1, engine_save, engine_load):
importorskip(engine_save)
importorskip(engine_load)

with tempfile.TemporaryDirectory() as tmpdir:
save_ds(ds1, os.path.join(tmpdir, "test.h5"), engine=engine_save)
ds2 = load_ds(os.path.join(tmpdir, "test.h5"), engine=engine_load)
Expand All @@ -93,6 +98,8 @@ def test_io_complex_data(self, ds1, engine_save, engine_load):
@mark.parametrize(("engine_load"),
['h5netcdf', 'netcdf4'])
def test_dask_load(self, ds_real, engine_load):
importorskip(engine_load)

with tempfile.TemporaryDirectory() as tmpdir:
save_ds(ds_real, os.path.join(tmpdir, "test.nc"))
ds2 = load_ds(os.path.join(tmpdir, "test.nc"),
Expand Down
Loading

0 comments on commit 46fd968

Please sign in to comment.