Action didn't raise an error
arkadybag opened this issue ยท 2 comments
arkadybag commented
Hello. First of all thanks for your action!
I am trying to use it for my project and it looks good! But I have some issues with it. When tests are finished without errors everything is ok, but when I have errors in tests I expect to have an error in the pipeline, but unfortunately, the action didn't fail.
I emulated error in tests and as you can see it was passed.
arkadybag commented
Solved.
My solution is set set -o pipefail
- name: Run pytest
run: |
set -o pipefail
poetry run pytest --color=yes --junitxml=/tmp/pytest.xml --cov-report=term-missing:skip-covered --cov=api --cov=services --cov=schemas --cov=repositories --cov=models tests/ | tee /tmp/pytest-coverage.txt
arkadybag commented
Also alternative option:
- name: Run pytest
run: |
poetry run pytest --color=yes --junitxml=/tmp/pytest.xml --cov-report=term-missing:skip-covered --cov=api --cov=services --cov=schemas --cov=repositories --cov=models tests/ 2>&1 | tee /tmp/pytest-coverage.txt; exit ${PIPESTATUS[0]}