@@ -34,12 +34,19 @@ commands =
3434 # https://github.com/actions/toolkit/blob/main/docs/commands.md#problem-matchers
3535 echo " ::add-matcher::.github/workflows/PYTHONWARNINGS-problemMatcher.json"
3636 echo " ::group::pytest"
37- pytest --cov -v --new-first -x --show-capture =all -rA --junitxml ={envlogdir}/junit.xml -o junit_family =legacy
38- echo " ::endgroup::"
39- sh -c ' if [ -n "{env:PYTEST_MD_REPORT_OUTPUT}" -a -n "{env:GITHUB_STEP_SUMMARY}" ];then \
37+ sh -c ' PYTEST_CODE=0 ;\
38+ pytest --cov -v --new-first -x --show-capture=all -rA \
39+ --junitxml={envlogdir}/junit.xml -o junit_family=legacy || \
40+ PYTEST_CODE=$? ;\
41+ echo "::endgroup::" ;\
42+ if [ -n "{env:PYTEST_MD_REPORT_OUTPUT}" -a -n "{env:GITHUB_STEP_SUMMARY}" ];then \
4043 mkdir -p $(dirname "{env:GITHUB_STEP_SUMMARY:.git/sum.md}"); \
4144 sed "s/tests\( .*py\) /[&](&)/" \
42- {env:PYTEST_MD_REPORT_OUTPUT} >{env:GITHUB_STEP_SUMMARY:.git/sum.md};fi'
45+ {env:PYTEST_MD_REPORT_OUTPUT} >{env:GITHUB_STEP_SUMMARY:.git/sum.md};fi ;\
46+ if [ $PYTEST_CODE != 0 ];then {[covcp]commands};exit $?;fi'
47+
48+ [covcp]
49+ commands = cp -av {envlogdir}/coverage.xml {envlogdir}/coverage.lcov {envlogdir}/.coverage {envlogdir}/junit.xml {env:UPLOAD_DIR:.}
4350
4451[testenv]
4552description = Run in a {basepython} virtualenv:
@@ -116,10 +123,10 @@ commands =
116123 check: {[check]commands}
117124 pytype: {[pytype]commands}
118125 {cov,covcp,covcombine,check,fox,test,mdreport}: {[test]commands}
126+ covcp: {[covcp]commands}
119127 # covcombine shall not call [cov]commands: diff-cover shall check the combined cov:
120128 {cov,covcp}: {[cov]commands}
121129 {py27-test}: pylint --py3k --disable =no-absolute-import xcp/
122- covcp: cp -av {envlogdir}/coverage.xml {envlogdir}/coverage.lcov {envlogdir}/.coverage {envlogdir}/junit.xml {env:UPLOAD_DIR:.}
123130 covcombine: {[covcombine]commands}
124131 fox: {[covcombine]commands}
125132 fox: {[lint]commands}
0 commit comments