Skip to content

Commit

Permalink
set test dir in step 1
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Nov 18, 2024
1 parent 04b43a8 commit 2a5b9fb
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
call-run-python-tests:
uses: openclimatefix/.github/.github/workflows/python-test.yml@issue/pip-all
with:
# pytest-cov looks at this folder
pytest_cov_dir: "quartz_solar_forecast"
os_list: '["ubuntu-latest"]'
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' }}
steps:
- name: Set test dir
run: |
export $TEST_DIR="tests/unit"
# if branch is 'main', or the repo is 'openclimatefix/quartz-solar-forecast'
# then run all tests, else run only unit tests
if [ ${{ github.event.repository.name }} == 'openclimatefix/quartz-solar-forecast' ] || [ ${{ github.ref }} == 'refs/heads/main' ]; then
export $TEST_DIR=""
fi
echo $TEST_DIR"
- name: Run Python tests
uses: openclimatefix/.github/.github/workflows/python-test.yml@issue/pip-all
with:
# pytest-cov looks at this folder
pytest_cov_dir: "quartz_solar_forecast"
os_list: '["ubuntu-latest"]'
python-version: "['3.11']"
extra_commands: echo "HF_TOKEN=${{ vars.HF_TOKEN }}" > .env
pytest_numcpus: '1'
test_dir: $TEST_DIR

0 comments on commit 2a5b9fb

Please sign in to comment.