python-utils-r1.eclass: use std test runner in eunittest in 3.12+

Starting with Python 3.12, the standard unittest runner exits
unsucessfully if no tests are found.  Therefore, we no longer need
to use unittest_or_fail.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2023-05-23 17:41:31 +02:00
parent 13324ce848
commit 1dca7a5241
+6 -1
View File
@@ -1344,7 +1344,12 @@ eunittest() {
_python_check_EPYTHON
set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}"
# unittest fails with "no tests" correctly since Python 3.12
local runner=unittest
if _python_impl_matches "${EPYTHON}" 3.{9..11}; then
runner=unittest_or_fail
fi
set -- "${EPYTHON}" -m "${runner}" discover -v "${@}"
echo "${@}" >&2
"${@}" || die -n "Tests failed with ${EPYTHON}"