1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-12 19:09:56 +03:00

pytest: generate coverage and junit reports (MR 2478)

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-11-04 10:35:05 +01:00
parent 87515529cf
commit e268ec24d5
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 9 additions and 2 deletions

View file

@ -23,15 +23,17 @@ fi
# Use pytest-cov if it is installed to display code coverage
cov_arg=""
if python -c "import pytest_cov" >/dev/null 2>&1; then
cov_arg="--cov=pmb"
cov_arg="--cov=pmb --cov-report term --cov-report xml:coverage.xml"
fi
echo "Running pytest..."
echo "NOTE: use 'pmbootstrap log' to see the detailed log if running locally."
# shellcheck disable=SC2086
python -m pytest \
--color=yes \
-vv \
-x \
--junitxml=junit.xml \
$cov_arg \
-m "not skip_ci" \
"$@"

View file

@ -43,10 +43,15 @@ pytest:
- "cp /home/build/.local/var/pmbootstrap/log_testsuite.txt ."
- "cp /home/build/.local/var/pmbootstrap/log.txt ."
artifacts:
when: on_failure
when: always
paths:
- "log_testsuite.txt"
- "log.txt"
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: junit.xml
# Ensure that tests pass on Python 3.10
pytest-python3.10: