Skip to content

Commit cff2953

Browse files
committed
make pint optional for running tests
1 parent eb65b5d commit cff2953

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

gsw_xarray/tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ def ds():
1414
ds["SA"] = ds["id"] * 0.1 + 34
1515
ds["SA"].attrs = {"standard_name": "sea_water_absolute_salinity"}
1616
return ds
17+
18+
19+
@pytest.fixture(scope="session")
20+
def ureg():
21+
pint = pytest.importorskip("pint")
22+
return pint.UnitRegistry()

gsw_xarray/tests/test_units.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@
66
from .test_imports import gsw_base
77
from gsw_xarray._attributes import _func_attrs
88

9-
from pint import UnitRegistry
10-
11-
ureg = UnitRegistry()
12-
139

1410
@pytest.mark.parametrize("func_name", gsw_base)
15-
def test_unit_pint(func_name):
11+
def test_unit_pint(func_name, ureg):
12+
1613
if func_name in ["indexer", "match_args_return", "pchip_interp"]:
1714
# Internal gsw cookery or non wrapped functions
1815
return

0 commit comments

Comments
 (0)