mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-13 03:19:47 +03:00
pytest: generate coverage and junit reports (MR 2478)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
87515529cf
commit
e268ec24d5
2 changed files with 9 additions and 2 deletions
|
@ -23,15 +23,17 @@ fi
|
||||||
# Use pytest-cov if it is installed to display code coverage
|
# Use pytest-cov if it is installed to display code coverage
|
||||||
cov_arg=""
|
cov_arg=""
|
||||||
if python -c "import pytest_cov" >/dev/null 2>&1; then
|
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
|
fi
|
||||||
|
|
||||||
echo "Running pytest..."
|
echo "Running pytest..."
|
||||||
echo "NOTE: use 'pmbootstrap log' to see the detailed log if running locally."
|
echo "NOTE: use 'pmbootstrap log' to see the detailed log if running locally."
|
||||||
|
# shellcheck disable=SC2086
|
||||||
python -m pytest \
|
python -m pytest \
|
||||||
--color=yes \
|
--color=yes \
|
||||||
-vv \
|
-vv \
|
||||||
-x \
|
-x \
|
||||||
|
--junitxml=junit.xml \
|
||||||
$cov_arg \
|
$cov_arg \
|
||||||
-m "not skip_ci" \
|
-m "not skip_ci" \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
|
@ -43,10 +43,15 @@ pytest:
|
||||||
- "cp /home/build/.local/var/pmbootstrap/log_testsuite.txt ."
|
- "cp /home/build/.local/var/pmbootstrap/log_testsuite.txt ."
|
||||||
- "cp /home/build/.local/var/pmbootstrap/log.txt ."
|
- "cp /home/build/.local/var/pmbootstrap/log.txt ."
|
||||||
artifacts:
|
artifacts:
|
||||||
when: on_failure
|
when: always
|
||||||
paths:
|
paths:
|
||||||
- "log_testsuite.txt"
|
- "log_testsuite.txt"
|
||||||
- "log.txt"
|
- "log.txt"
|
||||||
|
reports:
|
||||||
|
coverage_report:
|
||||||
|
coverage_format: cobertura
|
||||||
|
path: coverage.xml
|
||||||
|
junit: junit.xml
|
||||||
|
|
||||||
# Ensure that tests pass on Python 3.10
|
# Ensure that tests pass on Python 3.10
|
||||||
pytest-python3.10:
|
pytest-python3.10:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue