Skip to content

Commit

Permalink
refactor tests, and only run integration tests on main
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Nov 18, 2024
1 parent e4e6007 commit 04b43a8
Show file tree
Hide file tree
Showing 15 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ jobs:
python-version: "['3.11']"
extra_commands: echo "HF_TOKEN=${{ vars.HF_TOKEN }}" > .env
pytest_numcpus: '1'
# if branch is 'main' then run all tests, if not only run unittests
test_dir: ${{ github.ref == 'refs/heads/main' && '' || 'tests/unit' }}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from quartz_solar_forecast.evaluation import run_eval
import tempfile
import pandas as pd
import pytest


@pytest.test.integration
def test_run_eval():

# create a fake dataframe
Expand Down
2 changes: 2 additions & 0 deletions tests/eval/test_nwp.py → tests/integration/eval/test_nwp.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from quartz_solar_forecast.eval.nwp import get_nwp
import pandas as pd
import pytest


# can take ~ 1 minute to run
@pytest.test.integration
def test_get_nwp():
# make test dataset file
test_set_df = pd.DataFrame(
Expand Down
4 changes: 3 additions & 1 deletion tests/eval/test_pv.py → tests/integration/eval/test_pv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from quartz_solar_forecast.eval.pv import get_pv_truth, get_pv_metadata
import pandas as pd
import pytest


@pytest.mark.integration
def test_get_pv_metadata():
test_set_df = pd.DataFrame(
[
Expand All @@ -16,6 +17,7 @@ def test_get_pv_metadata():
assert "latitude" in metadata_df.columns


@pytest.mark.integration
def test_get_pv():
# make test dataset file
test_set_df = pd.DataFrame(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 04b43a8

Please sign in to comment.