From 2a5b9fb05fabe783cac58260241d07fe63fd4c0b Mon Sep 17 00:00:00 2001 From: peterdudfield Date: Mon, 18 Nov 2024 20:31:31 +0000 Subject: [PATCH] set test dir in step 1 --- .github/workflows/pytest.yaml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 40dfe4c..3c5e8a7 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -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 \ No newline at end of file