diff --git a/properties/test_encode_decode.py b/properties/test_encode_decode.py index 221083e16a1..4b0643cb2fe 100644 --- a/properties/test_encode_decode.py +++ b/properties/test_encode_decode.py @@ -4,9 +4,10 @@ These ones pass, just as you'd hope! """ -import pytest # isort:skip +import pytest pytest.importorskip("hypothesis") +# isort: split import hypothesis.extra.numpy as npst import hypothesis.strategies as st diff --git a/setup.cfg b/setup.cfg index c44d207bf0f..2059d471e23 100644 --- a/setup.cfg +++ b/setup.cfg @@ -161,7 +161,7 @@ exclude= [isort] profile = black skip_gitignore = true -force_to_top = true +float_to_top = true default_section = THIRDPARTY known_first_party = xarray 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