From 1dca7a52411f4f0b5a244a6dccc7638bb4644a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 23 May 2023 16:53:41 +0200 Subject: [PATCH] python-utils-r1.eclass: use std test runner in eunittest in 3.12+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- eclass/python-utils-r1.eclass | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index d21e54c6ecc9c..40792714cc56e 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}"