summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-05-23 16:53:41 +0200
committerMichał Górny <mgorny@gentoo.org>2023-05-23 17:41:31 +0200
commit1dca7a52411f4f0b5a244a6dccc7638bb4644a6d (patch)
treee71eaf63f15ac60f4ceeed7bdfca93e38ac4ee4a /eclass/python-utils-r1.eclass
parentdev-python/yarl: Stabilize 1.9.2 sparc, #907026 (diff)
downloadgentoo-1dca7a52411f4f0b5a244a6dccc7638bb4644a6d.tar.gz
gentoo-1dca7a52411f4f0b5a244a6dccc7638bb4644a6d.tar.bz2
gentoo-1dca7a52411f4f0b5a244a6dccc7638bb4644a6d.zip
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>
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass7
1 files changed, 6 insertions, 1 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index d21e54c6ecc9..40792714cc56 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -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}"