Skip to content

Commit

Permalink
Conditionally run rasterio unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
naschmitz authored Dec 21, 2023
1 parent 81766cf commit 24ff582
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions xee/ext_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@
import numpy as np
import xarray as xr
from xarray.core import indexing
import rioxarray
import rasterio
import xee

import ee

_SKIP_RASTERIO_TESTS = False
try:
import rasterio # pylint: disable=g-import-not-at-top
import rioxarray # pylint: disable=g-import-not-at-top,unused-import
except ImportError:
_SKIP_RASTERIO_TESTS = True

_CREDENTIALS_PATH_KEY = 'GOOGLE_APPLICATION_CREDENTIALS'
_SCOPES = [
'https://www.googleapis.com/auth/cloud-platform',
Expand Down Expand Up @@ -400,6 +405,7 @@ def test_validate_band_attrs(self):
for _, value in variable.attrs.items():
self.assertIsInstance(value, valid_types)

@absltest.skipIf(_SKIP_RASTERIO_TESTS, 'rioxarray module not loaded')
def test_write_projected_dataset_to_raster(self):
# ensure that a projected dataset written to a raster intersects with the
# point used to create the initial image collection
Expand Down Expand Up @@ -436,6 +442,7 @@ def test_write_projected_dataset_to_raster(self):
intersects = bbox.intersects(point, 1, proj=proj)
self.assertTrue(intersects.getInfo())

@absltest.skipIf(_SKIP_RASTERIO_TESTS, 'rioxarray module not loaded')
def test_write_dataset_to_raster(self):
# ensure that a dataset written to a raster intersects with the point used
# to create the initial image collection
Expand Down

0 comments on commit 24ff582

Please sign in to comment.