Skip to content

Commit

Permalink
Run python test in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
s-simoncelli committed Apr 28, 2024
1 parent 0e05e00 commit 0c4e985
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
# architecture: x64
# - name: Install fontconfig
# run: sudo apt-get install -y fontconfig libfontconfig-dev libfontconfig1 libfontconfig1-dev

# - name: Test Python API
# run: |
# pip install pytest pandas
# python -m pytest
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
Expand All @@ -39,6 +44,7 @@ jobs:
# with:
# name: wheels-linux-${{ matrix.platform.target }}
# path: dist
# overwrite: true

windows:
runs-on: windows-latest
Expand All @@ -51,6 +57,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Test Python API
run: |
pip install pytest pandas
python -m pytest
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand All @@ -62,6 +72,7 @@ jobs:
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist
overwrite: true

macos:
runs-on: macos-latest
Expand All @@ -74,6 +85,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Test Python API
run: |
pip install pytest pandas
python -m pytest
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand All @@ -85,6 +100,7 @@ jobs:
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
overwrite: true

sdist:
runs-on: ubuntu-latest
Expand Down
11 changes: 9 additions & 2 deletions gr6j-python/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

import pandas as pd
from datetime import date

Expand All @@ -18,10 +20,15 @@
)


def test_simple_model():
@pytest.fixture
def data_path() -> Path:
return Path(__file__).parent.parent.parent / "gr6j-core" / "src" / "test_data"


def test_simple_model(data_path):
# Read the input data
data = pd.read_csv(
r"../../gr6j-core/src/test_data/airGR_L0123001_dataset.csv",
data_path / "airGR_L0123001_dataset.csv",
index_col=[0],
parse_dates=True,
dayfirst=True,
Expand Down

0 comments on commit 0c4e985

Please sign in to comment.