Skip to content

Commit 20d136d

Browse files
committed
Tests: prevent failure if netCDF4 not installed.
1 parent 5390f54 commit 20d136d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pgfutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
3737
"""
3838

39-
__version__ = "1.3.0"
39+
__version__ = "1.3.1"
4040

4141
# We don't import Matplotlib here as this brings in NumPy. In turn, NumPy
4242
# caches a reference to the io.open() method as part of its data loading

tests/test_tracking.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,16 @@ def test_manual_file(self):
341341

342342

343343
def test_extra_trackers_unknown(self):
344-
"""File trackers raises error if unknown extra_trackers option given..."""
344+
"""File trackers raises error if unknown extra_tracking option given..."""
345345
with pytest.raises(ValueError):
346346
pgfutils._install_extra_file_trackers(["unknown"])
347-
with pytest.raises(ValueError):
348-
pgfutils._install_extra_file_trackers(["netCDF4", "unknown"])
347+
try:
348+
import netCDF4
349+
except ImportError:
350+
pass
351+
else:
352+
with pytest.raises(ValueError):
353+
pgfutils._install_extra_file_trackers(["netCDF4", "unknown"])
349354

350355

351356
def test_netcdf4_setup(self):

0 commit comments

Comments
 (0)