Skip to content

Commit 623eba0

Browse files
authored
Warnings(17) filtering for non-GPU (#850)
* cleand up some test warnings
1 parent ebb4872 commit 623eba0

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

xrspatial/tests/test_classify.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ def test_natural_breaks_not_enough_unique_values():
211211
agg = input_data()
212212
n_uniques = np.isfinite(agg.data).sum()
213213
k = n_uniques + 1
214-
result_natural_breaks = natural_breaks(agg, k=k)
214+
with pytest.warns(Warning):
215+
result_natural_breaks = natural_breaks(agg, k=k)
215216
n_uniques_result = np.isfinite(result_natural_breaks.data).sum()
216217
np.testing.assert_allclose(n_uniques_result, n_uniques)
217218

xrspatial/tests/test_focal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def data_hotspots():
457457
def test_hotspots_zero_global_std():
458458
data = np.zeros((10, 20))
459459
agg = create_test_raster(data)
460-
kernel = np.zeros((3, 3))
460+
kernel = np.ones((3, 3))
461461
msg = "Standard deviation of the input raster values is 0."
462462
with pytest.raises(ZeroDivisionError, match=msg):
463463
hotspots(agg, kernel)

xrspatial/tests/test_pathfinding.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def test_a_star_search_no_barriers(input_data):
7474
assert np.nanmin(path_agg) == 0
7575

7676

77+
@pytest.mark.filterwarnings("ignore:Start at a non crossable location:Warning")
78+
@pytest.mark.filterwarnings("ignore:End at a non crossable location:Warning")
7779
def test_a_star_search_with_barriers(input_data):
7880
agg = input_data
7981
barriers = [1]
@@ -92,6 +94,8 @@ def test_a_star_search_with_barriers(input_data):
9294
general_output_checks(agg, path_agg, expected_results)
9395

9496

97+
@pytest.mark.filterwarnings("ignore:Start at a non crossable location:Warning")
98+
@pytest.mark.filterwarnings("ignore:End at a non crossable location:Warning")
9599
def test_a_star_search_snap(input_data_with_nans):
96100
agg, start, goal = input_data_with_nans
97101

xrspatial/tests/test_zonal.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ def test_default_stats_dataarray(
447447
assert_input_data_unmodified(data_zones, copied_data_zones)
448448
assert_input_data_unmodified(data_values_2d, copied_data_values_2d)
449449

450-
450+
@pytest.mark.filterwarnings("ignore:All-NaN slice encountered:RuntimeWarning")
451+
@pytest.mark.filterwarnings("ignore:invalid value encountered in divide:RuntimeWarning")
451452
@pytest.mark.parametrize("backend", ['numpy', 'dask+numpy', 'cupy'])
452453
def test_zone_ids_stats(backend, data_zones, data_values_2d, result_zone_ids_stats,
453454
result_zone_ids_stats_no_majority):

0 commit comments

Comments
 (0)