enforce mock on online test

This commit is contained in:
yzlin 2024-01-05 20:38:07 +08:00
parent afa2411909
commit 8fb5919181
3 changed files with 7 additions and 5 deletions

View file

@ -33,6 +33,7 @@ jobs:
sh tests/scripts/run_install_deps.sh
- name: Test with pytest
run: |
export ALLOW_OPENAI_API_CALL=0
echo "${{ secrets.METAGPT_KEY_YAML }}" | base64 -d > config/key.yaml
pytest tests/ --doctest-modules --cov=./metagpt/ --cov-report=xml:cov.xml --cov-report=html:htmlcov --durations=20 | tee unittest.txt
- name: Show coverage report
@ -40,8 +41,8 @@ jobs:
coverage report -m
- name: Show failed tests and overall summary
run: |
grep -E "FAILED tests|[0-9]+ passed," unittest.txt
failed_count=$(grep "FAILED" unittest.txt | wc -l)
grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt
failed_count=$(grep "FAILED|ERROR" unittest.txt | wc -l)
if [[ "$failed_count" -gt 0 ]]; then
echo "$failed_count failed lines found! Task failed."
exit 1