Skip to content

Commit eac906b

Browse files
committed
Enable junit.xml reporting to codecov.io
1 parent 6cab930 commit eac906b

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pip-log.txt
2828

2929
# Unit test / coverage reports
3030
.tox
31+
junit.xml
3132

3233
# Needed for CLI tests
3334
.sandbox

pyproject.toml

+1-5
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,7 @@ filterwarnings = [
411411
# https://github.com/ansible/ansible/pull/80968
412412
"ignore:Attribute s is deprecated and will be removed in Python 3.14; use value instead:DeprecationWarning"
413413
]
414-
junit_duration_report = "call"
415-
junit_family = "xunit1"
416-
# Our github annotation parser from .github/workflows/tox.yml requires xunit1 format. Ref:
417-
# https://github.com/shyim/junit-report-annotations-action/issues/3#issuecomment-663241378
418-
junit_suite_name = "ansible_lint_test_suite"
414+
junit_family = "legacy"
419415
minversion = "4.6.6"
420416
# https://code.visualstudio.com/docs/python/testing
421417
# coverage is re-enabled in `tox.ini`. That approach is safer than

tools/report-coverage

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
coverage combine -q "--data-file=${TOX_ENV_DIR}/.coverage" "${TOX_ENV_DIR}"/.coverage.*
4+
coverage xml "--data-file=${TOX_ENV_DIR}/.coverage" -o "${TOX_ENV_DIR}/coverage.xml" --ignore-errors --fail-under=0
5+
COVERAGE_FILE="${TOX_ENV_DIR}/.coverage" coverage report --fail-under=0 --ignore-errors

tox.ini

+4-1
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ commands =
7777
--showlocals \
7878
--doctest-modules \
7979
--durations=10 \
80+
--junitxml=./junit.xml \
8081
}
81-
{py,py310,py311,py312,py313}: sh -c "coverage combine -a -q --data-file={env_dir}/.coverage {work_dir}/*/.coverage.* && coverage xml --data-file={env_dir}/.coverage -o {env_dir}/coverage.xml --fail-under=0 && coverage report --data-file={env_dir}/.coverage"
82+
commands_post =
83+
{py,py310,py311,py312,py313}: ./tools/report-coverage
8284
allowlist_externals =
85+
./tools/report-coverage
8386
./tools/test-hook.sh
8487
bash
8588
find

0 commit comments

Comments
 (0)