summaryrefslogtreecommitdiff
path: root/eclass/python-utils-r1.eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2025-06-15 16:58:22 +0200
committerMichał Górny <mgorny@gentoo.org>2025-06-25 06:35:37 +0200
commitd909a4e5c4828969e1af52d6199d1539f238a04a (patch)
tree6cfc35692169a547a0ac4336af8dd814fb11e7ac /eclass/python-utils-r1.eclass
parent1cab1b738232b8ffa9f6834e4af8177cdbc15f27 (diff)
downloadgentoo-d909a4e5c4828969e1af52d6199d1539f238a04a.tar.gz
gentoo-d909a4e5c4828969e1af52d6199d1539f238a04a.tar.bz2
gentoo-d909a4e5c4828969e1af52d6199d1539f238a04a.zip
python-utils-r1.eclass: epytest, create junit xml
Request pytest to output junit format xml files that could be used for further machine processing of test results. Use xunit1 format since it includes filenames that are useful for decoding the `classname` attribute. The potential use cases include automatically generating `EPYTEST_DESELECT` from test failures and verifying the existing lists for stale values. We use `mktemp` to create unique filenames, to account for `epytest` being called multiple times in a single test phase. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass7
1 files changed, 7 insertions, 0 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index c535a79cb48e..6c887626cbd1 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1324,6 +1324,9 @@ epytest() {
local color=yes
[[ ${NO_COLOR} ]] && color=no
+ mkdir -p "${T}/pytest-xml" || die
+ local junit_xml=$(mktemp "${T}/pytest-xml/${EPYTHON}-XXX.xml" || die)
+
local args=(
# verbose progress reporting and tracebacks
-vv
@@ -1345,6 +1348,10 @@ epytest() {
# we don't need to preserve them
-o tmp_path_retention_count=0
-o tmp_path_retention_policy=failed
+ # write a junit .xml file to aid machine processing of results
+ --junit-xml="${junit_xml}"
+ # use xunit1 format as that includes an explicit path
+ -o junit_family=xunit1
)
if has_version ">=dev-python/pytest-8.4.0"; then