1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sun, 23 Dec 2018 10:36:27 +0000
Subject: Skip tests using external data
Forwarded: not-needed
---
geotiepoints/tests/test_modis.py | 5 +++++
geotiepoints/tests/test_modisinterpolator.py | 3 +++
geotiepoints/tests/test_simple_modis_interpolator.py | 7 +++++++
3 files changed, 15 insertions(+)
diff --git a/geotiepoints/tests/test_modis.py b/geotiepoints/tests/test_modis.py
index b1532ff..4bc1fd6 100644
--- a/geotiepoints/tests/test_modis.py
+++ b/geotiepoints/tests/test_modis.py
@@ -19,6 +19,7 @@
import numpy as np
import h5py
import os
+import unittest
import pytest
@@ -54,6 +55,8 @@ class TestUtils:
class TestMODIS:
"""Class for system testing the MODIS interpolation."""
+ @unittest.skipIf(not os.path.isfile(FILENAME_FULL), 'deta file not available')
+ @unittest.skipIf(not os.path.isfile(FILENAME_5KM), 'deta file not available')
def test_5_to_1(self):
"""Test the 5km to 1km interpolation facility."""
@@ -70,6 +73,8 @@ class TestMODIS:
np.testing.assert_allclose(tlons, glons, atol=0.05)
np.testing.assert_allclose(tlats, glats, atol=0.05)
+ @unittest.skipIf(not os.path.isfile(FILENAME_250M_RESULT), 'deta file not available')
+ @unittest.skipIf(not os.path.isfile(FILENAME_250M_INPUT), 'deta file not available')
@pytest.mark.parametrize("ncores", [None, 4])
def test_1000m_to_250m(self, ncores):
"""Test the 1 km to 250 meter interpolation facility."""
diff --git a/geotiepoints/tests/test_modisinterpolator.py b/geotiepoints/tests/test_modisinterpolator.py
index 35d5ff5..78ac1ce 100644
--- a/geotiepoints/tests/test_modisinterpolator.py
+++ b/geotiepoints/tests/test_modisinterpolator.py
@@ -123,6 +123,7 @@ def assert_geodetic_distance(
"meters from the expected coordinates.")
+@pytest.mark.skipif(not os.path.isfile(FILENAME_DATA), reason='data file not available')
@pytest.mark.parametrize(
("input_func", "exp_func", "interp_func", "dist_max", "exp_5km_warning"),
[
@@ -156,6 +157,7 @@ def test_sat_angle_based_interp(input_func, exp_func, interp_func, dist_max, exp
assert not np.any(np.isnan(lats))
+@pytest.mark.skipif(not os.path.isfile(FILENAME_DATA), reason='data file not available')
def test_sat_angle_based_interp_nan_handling():
# See GH #19
lon1, lat1, satz1 = load_1km_lonlat_satz_as_xarray_dask()
@@ -165,6 +167,7 @@ def test_sat_angle_based_interp_nan_handling():
assert not np.any(np.isnan(lats.compute()))
+@pytest.mark.skipif(not os.path.isfile(FILENAME_DATA), reason='data file not available')
def test_poles_datum():
orig_lon, lat1, satz1 = load_1km_lonlat_satz_as_xarray_dask()
lon1 = orig_lon + 180
diff --git a/geotiepoints/tests/test_simple_modis_interpolator.py b/geotiepoints/tests/test_simple_modis_interpolator.py
index 3af03ef..34ccc24 100644
--- a/geotiepoints/tests/test_simple_modis_interpolator.py
+++ b/geotiepoints/tests/test_simple_modis_interpolator.py
@@ -20,6 +20,11 @@ import numpy as np
import pytest
import dask
import dask.array as da
+import os
+
+FILENAME_DATA = os.path.join(
+ os.path.dirname(__file__), '../../testdata/modis_test_data.h5')
+
from geotiepoints.simple_modis_interpolator import modis_1km_to_250m, modis_1km_to_500m
from .test_modisinterpolator import (
@@ -34,6 +39,7 @@ from .test_modisinterpolator import (
from .utils import CustomScheduler
+@pytest.mark.skipif(not os.path.exists(FILENAME_DATA), reason="data file not available")
@pytest.mark.parametrize(
("input_func", "exp_func", "interp_func", "dist_max"),
[
@@ -60,6 +66,7 @@ def test_basic_interp(input_func, exp_func, interp_func, dist_max):
assert not np.any(np.isnan(lats))
+@pytest.mark.skipif(not os.path.exists(FILENAME_DATA), reason="data file not available")
def test_nonstandard_scan_size():
lon1, lat1 = load_1km_lonlat_as_xarray_dask()
# remove 1 row from the end
|