Skip to content

Commit

Permalink
test: smarter skip netCDF4
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jan 9, 2025
1 parent cc6f966 commit 0ac46a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 2 additions & 6 deletions src/georinex/tests/test_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

import georinex as gr

try:
import netCDF4
except ImportError:
netCDF4 = None

R = Path(__file__).parent / "data"

Expand All @@ -24,8 +20,8 @@
ids=["obs2", "obs3", "nav2", "nav3", "Cobs1", "NetCDF_obs2"],
)
def test_header(fn, rtype, vers):
if fn.suffix == ".nc" and netCDF4 is None:
pytest.skip("no netCDF4")
if fn.suffix == ".nc":
pytest.importorskip("netCDF4")

hdr = gr.rinexheader(fn)
assert isinstance(hdr, dict)
Expand Down
10 changes: 8 additions & 2 deletions src/georinex/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import numpy
import sys
import pandas
import netCDF4
try:
import netCDF4
except ImportError:
pass

from . import __version__

Expand All @@ -11,7 +14,10 @@
print("xarray", xarray.__version__)
print("Numpy", numpy.__version__)
print("Pandas", pandas.__version__)
print("NetCDF4", netCDF4.__version__)
try:
print("NetCDF4", netCDF4.__version__)
except NameError:
print("netCDF4 not available")

try:
import pytest
Expand Down

0 comments on commit 0ac46a6

Please sign in to comment.