Skip to content

Commit 00ce092

Browse files
authored
Codecov: disable Numba; ignore tests, experimental, and gpu_rtx (#673)
* analytics: test no name * codecov: disable numba * convolve 2d: dtype of array at initialization * flake8 * run codecov once when push to PR * ignore test polygonize when measuring codecov with numba disabled * ignore experimental from codecov report * exclude tests from codecov report * retry * codecov retry
1 parent b9626f7 commit 00ce092

File tree

6 files changed

+36
-15
lines changed

6 files changed

+36
-15
lines changed

.github/workflows/codecov.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
name: Codecov
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- '*'
9+
310
jobs:
411
run:
512
runs-on: ${{ matrix.os }}
@@ -22,7 +29,7 @@ jobs:
2229
pip install -e .[tests]
2330
- name: Generate coverage report
2431
run: |
25-
pytest --cov=./ --cov-report=xml
32+
NUMBA_DISABLE_JIT=1 pytest --cov=./ --cov-report=xml --ignore ./xrspatial/tests/test_polygonize.py
2633
- name: Upload coverage to Codecov
2734
uses: codecov/codecov-action@v2
2835
with:

codecov.yml

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
coverage:
2-
status:
3-
patch: off
4-
project:
5-
default:
6-
target: auto
7-
threshold: 1%
2+
status:
3+
patch: off
4+
project:
5+
default:
6+
target: auto
7+
threshold: 0.5%
88

9-
comment:
10-
require_changes: yes
9+
comment:
10+
require_changes: yes
11+
12+
ignore:
13+
- "xrspatial/tests/test_polygonize.py"
14+
- "xrspatial/experimental/*"
15+
- "xrspatial/gpu_rtx/*"
16+
- "xrspatial/tests/*"

xrspatial/convolution.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import numpy as np
55
import xarray as xr
6-
from numba import cuda, float32, jit, prange
6+
from numba import cuda, jit, prange
77

88
from xrspatial.utils import (ArrayTypeFunctionMapping, cuda_args, get_dataarray_resolution,
99
not_implemented_func)
@@ -294,7 +294,7 @@ def _convolve_2d_numpy(data, kernel):
294294
wkx = nkx // 2
295295
wky = nky // 2
296296

297-
out = np.zeros(data.shape, dtype=float32)
297+
out = np.zeros(data.shape, dtype=np.float32)
298298
out[:] = np.nan
299299
for i in prange(wkx, nx-wkx):
300300
iimin = max(i - wkx, 0)

xrspatial/terrain.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _gen_terrain(height_map, seed, x_range=(0, 1), y_range=(0, 1)):
4141
y_range[0], y_range[1], height, endpoint=False, dtype=np.float32
4242
)
4343
x, y = np.meshgrid(linx, liny)
44-
nrange = np.arange(2**20, dtype=int)
44+
nrange = np.arange(2**20, dtype=np.int32)
4545
for i, (m, (xfreq, yfreq)) in enumerate(NOISE_LAYERS):
4646
np.random.seed(seed+i)
4747
p = np.random.permutation(nrange)
@@ -93,7 +93,7 @@ def _terrain_dask_numpy(data: da.Array,
9393
)
9494
x, y = da.meshgrid(linx, liny)
9595

96-
nrange = np.arange(2 ** 20, dtype=int)
96+
nrange = np.arange(2 ** 20, dtype=np.int32)
9797

9898
# multiplier, (xfreq, yfreq)
9999
NOISE_LAYERS = ((1 / 2 ** i, (2 ** i, 2 ** i)) for i in range(16))

xrspatial/tests/test_analytics.py

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
from xrspatial.tests.general_checks import create_test_raster
77

88

9+
def test_summarize_terrain_no_name():
10+
data = np.zeros((10, 20))
11+
test_terrain = create_test_raster(data, name=None)
12+
msg = "Requires xr.DataArray.name property to be set"
13+
with pytest.raises(NameError, match=msg):
14+
summarize_terrain(test_terrain)
15+
16+
917
@pytest.mark.parametrize("size", [(2, 4), (100, 150)])
1018
@pytest.mark.parametrize(
1119
"dtype", [np.int32, np.int64, np.uint32, np.uint64, np.float32, np.float64]

xrspatial/tests/test_zonal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def test_apply():
250250
def func(x):
251251
return 0
252252

253-
zones_val = np.zeros((3, 3), dtype=int)
253+
zones_val = np.zeros((3, 3), dtype=np.int32)
254254
# define some zones
255255
zones_val[1] = 1
256256
zones_val[2] = 2

0 commit comments

Comments
 (0)