eclass/python-utils-r1: Sync with Gentoo

It's from Gentoo commit 635892e8f096afd7d1f3ea2f91a6906122b2e5ca.
This commit is contained in:
Flatcar Buildbot 2024-01-15 07:13:39 +00:00 committed by Krzesimir Nowak
parent afb9a4e498
commit ef7470dc4d

View File

@ -1,4 +1,4 @@
# Copyright 1999-2023 Gentoo Authors
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-utils-r1.eclass
@ -1296,6 +1296,16 @@ _python_check_occluded_packages() {
# parameter, when calling epytest. The listed files will be entirely
# skipped from test collection.
# @ECLASS_VARIABLE: EPYTEST_TIMEOUT
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set to a non-empty value, enables pytest-timeout plugin and sets
# test timeout to the specified value. This variable can be either set
# in ebuilds that are known to hang, or by user to prevent hangs
# in automated test environments. If this variable is set prior
# to calling distutils_enable_tests in distutils-r1, a test dependency
# on dev-python/pytest-timeout is added automatically.
# @ECLASS_VARIABLE: EPYTEST_XDIST
# @DEFAULT_UNSET
# @DESCRIPTION:
@ -1344,6 +1354,11 @@ epytest() {
# count is more precise when we're dealing with a large number
# of tests
-o console_output_style=count
# minimize the temporary directory retention, the test suites
# of some packages can grow them pretty large and normally
# we don't need to preserve them
-o tmp_path_retention_count=0
-o tmp_path_retention_policy=failed
)
if [[ ! ${PYTEST_DISABLE_PLUGIN_AUTOLOAD} ]]; then
@ -1376,6 +1391,18 @@ epytest() {
)
fi
if [[ -n ${EPYTEST_TIMEOUT} ]]; then
if [[ ${PYTEST_PLUGINS} != *pytest_timeout* ]]; then
args+=(
-p timeout
)
fi
args+=(
"--timeout=${EPYTEST_TIMEOUT}"
)
fi
if [[ ${EPYTEST_XDIST} ]]; then
local jobs=${EPYTEST_JOBS:-$(makeopts_jobs)}
if [[ ${jobs} -gt 1 ]]; then