fix(ci): install pytest when pyproject.toml is missing
CI / lint (push) Successful in 7s
CI / lint (pull_request) Successful in 7s
CI / test (push) Successful in 4s
CI / test (pull_request) Successful in 4s
CI / notify-on-failure (push) Successful in 2s
CI / notify-on-failure (pull_request) Successful in 1s

Root cause: ci.yml test job creates .venv but skips dev install when
pyproject.toml is absent, leaving pytest uninstalled. Then .venv/bin/pytest
fails with 'No such file or directory'.

Fix: Install pytest directly when no pyproject.toml, and use /tmp path
to avoid workspace pollution.
This commit is contained in:
cfdaily
2026-06-11 11:15:47 +08:00
parent f8c742ed41
commit d53c3d290f
+4 -4
View File
@@ -47,17 +47,17 @@ jobs:
- name: Setup Python - name: Setup Python
run: | run: |
python3 -m venv .venv python3 -m venv /tmp/ci-venv-test
if [ -f pyproject.toml ]; then if [ -f pyproject.toml ]; then
.venv/bin/pip install --quiet -e ".[dev]" /tmp/ci-venv-test/bin/pip install --quiet -e ".[dev]"
else else
echo "No pyproject.toml, skipping dev install" /tmp/ci-venv-test/bin/pip install --quiet pytest
fi fi
- name: Run tests (exclude E2E) - name: Run tests (exclude E2E)
run: | run: |
if [ -d tests ]; then if [ -d tests ]; then
.venv/bin/pytest tests/ -m "not e2e" -x -q /tmp/ci-venv-test/bin/pytest tests/ -m "not e2e" -x -q
else else
echo "No tests/ directory, skipping tests" echo "No tests/ directory, skipping tests"
fi fi