diff --git a/properties/test_encode_decode.py b/properties/test_encode_decode.py index 221083e16a1..8f1d232ba2f 100644 --- a/properties/test_encode_decode.py +++ b/properties/test_encode_decode.py @@ -6,14 +6,14 @@ """ import pytest # isort:skip -pytest.importorskip("hypothesis") - +pytest.importorskip("hypothesis") # isort:split import hypothesis.extra.numpy as npst import hypothesis.strategies as st from hypothesis import given import xarray as xr + an_array = npst.arrays( dtype=st.one_of( npst.unsigned_integer_dtypes(), npst.integer_dtypes(), npst.floating_dtypes() diff --git a/xarray/core/parallel.py b/xarray/core/parallel.py index 2c7f4249b5e..20ec3608ebb 100644 --- a/xarray/core/parallel.py +++ b/xarray/core/parallel.py @@ -1,12 +1,3 @@ -try: - import dask - import dask.array - from dask.array.utils import meta_from_array - from dask.highlevelgraph import HighLevelGraph - -except ImportError: - pass - import collections import itertools import operator @@ -31,6 +22,16 @@ from .dataarray import DataArray from .dataset import Dataset +try: + import dask + import dask.array + from dask.array.utils import meta_from_array + from dask.highlevelgraph import HighLevelGraph + +except ImportError: + pass + + T_DSorDA = TypeVar("T_DSorDA", DataArray, Dataset) diff --git a/xarray/tests/test_units.py b/xarray/tests/test_units.py index 2140047f38e..543100ef98c 100644 --- a/xarray/tests/test_units.py +++ b/xarray/tests/test_units.py @@ -5,11 +5,6 @@ import pandas as pd import pytest -try: - import matplotlib.pyplot as plt -except ImportError: - pass - import xarray as xr from xarray.core import dtypes, duck_array_ops @@ -23,6 +18,12 @@ from .test_plot import PlotTestCase from .test_variable import _PAD_XR_NP_ARGS +try: + import matplotlib.pyplot as plt +except ImportError: + pass + + pint = pytest.importorskip("pint") DimensionalityError = pint.errors.DimensionalityError