From 9f31df7f3a9dac47a7e6a5b567cde4e1065c5fab Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 5 Jul 2025 13:52:28 +0200 Subject: [PATCH] pytest recommendation: `pip install --editable .` https://docs.pytest.org/en/stable/how-to/existingtestsuite.html This makes setting `PYTHONPATH` unnecessary and will pull requirements from `pyproject.toml` instead of `requirements.txt`, so it is similar to end-user installations. `makedir -p data/plugins` will do both `mkdir data` and `mkdir data/plugins`. The `$CI` environment variable might be better to use than `$TESTING` because it is preset to `true` in GitHub Actions. * https://docs.github.com/en/actions/reference/variables-reference#default-environment-variables * https://docs.pytest.org/en/stable/explanation/ci.html --- .github/workflows/coverage_test.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/coverage_test.yml b/.github/workflows/coverage_test.yml index a62efa5d2..3f219121c 100644 --- a/.github/workflows/coverage_test.yml +++ b/.github/workflows/coverage_test.yml @@ -26,20 +26,19 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install pytest pytest-cov pytest-asyncio + pip install pytest pytest-asyncio pytest-cov + pip install --editable . - name: Run tests run: | - mkdir data - mkdir data/plugins - mkdir data/config - mkdir data/temp + mkdir -p data/plugins + mkdir -p data/config + mkdir -p data/temp export TESTING=true export ZHIPU_API_KEY=${{ secrets.OPENAI_API_KEY }} - PYTHONPATH=./ pytest --cov=. tests/ -v -o log_cli=true -o log_level=DEBUG + pytest --cov=. tests/ -v -o log_cli=true -o log_level=DEBUG - name: Upload results to Codecov uses: codecov/codecov-action@v5 with: - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + token: ${{ secrets.CODECOV_TOKEN }}