Skip to content

Commit

Permalink
add pytest action
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasK committed Oct 31, 2023
1 parent 52d606d commit b77028d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pytest-dev

on:
push:
branches:
- dev

jobs:
pytest:
runs-on: ubuntu-latest
name: Sphinx docs to gh-pages
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Make conda environment
uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.1-0'
environment-file: requirements_dev.yml
environment-name: earthdaily
cache-environment: true
post-cleanup: 'all'
init-shell: bash
- name: Installing the library
shell: bash -l {0}
run: |
pip install .
- name: tests and coverage
env:
EDS_CLIENT_ID: ${{ secrets.EDS_CLIENT_ID }}
EDS_AUTH_URL: ${{ secrets.EDS_AUTH_URL }}
EDS_SECRET: ${{ secrets.EDS_SECRET }}
EDS_API_URL: ${{ secrets.EDS_API_URL }}
run: |
pytest -v tests --cov=earthdaily
3 changes: 1 addition & 2 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
with:
src: "./earthdaily"
args: format

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'style fixes by ruff'
commit_message: 'ghactions/auto fix with ruff'
3 changes: 2 additions & 1 deletion earthdaily/earthdatastore/cube_utils/_zonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def zonal_stats_numpy(

feats, yx_pos = _rasterize(gdf, dataset, all_touched=all_touched)
ds = []
features_idx = []
for data_var in dataset.data_vars:
tqdm_bar.set_description(data_var)
dataset_var = dataset[data_var]
Expand All @@ -70,7 +71,7 @@ def zonal_stats_numpy(
vals[t] = []
mem_asset = dataset_var.isel(time=t).to_numpy()
for i in range(gdf.shape[0]):
features.append(i)
features_idx.append(i)
if len(yx_pos) <= i + 1:
break
pos = np.asarray(yx_pos[i + 1])
Expand Down
Empty file added tests/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/tests_assetmapper.py → tests/test_assetmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from earthdaily.earthdatastore.cube_utils.asset_mapper import AssetMapper


class TestZonalStats(unittest.TestCase):
class TestAssetMapper(unittest.TestCase):
def setUp(self):
self.aM = AssetMapper()

Expand Down
File renamed without changes.

0 comments on commit b77028d

Please sign in to comment.