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>
---
eclass/python-utils-r1.eclass | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index c535a79cb48e..83727468b603 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")
+
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
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)