Only run NetCDF tests if NetCDF driver is installed.

This commit is contained in:
Kevin Wurster 2017-10-11 20:34:23 -04:00
parent 896d3370f4
commit 2069c1e97f
2 changed files with 12 additions and 0 deletions

View File

@ -11,6 +11,10 @@ from rasterio.rio.edit_info import (
from rasterio.rio.main import main_group
with rasterio.Env() as env:
HAVE_NETCDF = 'NetCDF' in env.drivers().keys()
def test_delete_nodata_exclusive_opts(data):
"""--unset-nodata and --nodata can't be used together"""
runner = CliRunner()
@ -781,6 +785,8 @@ def test_info_checksums_only():
@pytest.mark.skipif(parse(rasterio.__gdal_version__) < parse('2.1'),
reason='netCDF requires GDAL 2.1+')
@pytest.mark.skipif(not HAVE_NETCDF,
reason="GDAL not compiled with NetCDF driver.")
def test_info_subdatasets():
runner = CliRunner()
result = runner.invoke(

View File

@ -4,8 +4,14 @@ import pytest
import rasterio
with rasterio.Env() as env:
HAVE_NETCDF = 'NetCDF' in env.drivers().keys()
@pytest.mark.skipif(parse(rasterio.__gdal_version__) < parse('2.1'),
reason="netcdf driver not available before GDAL 2.1")
@pytest.mark.skipif(not HAVE_NETCDF,
reason="GDAL not compiled with NetCDF driver.")
def test_subdatasets():
"""Get subdataset names and descriptions"""
with rasterio.open('netcdf:tests/data/RGB.nc') as src: