summaryrefslogtreecommitdiff
path: root/eclass/python-utils-r1.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-01-06 00:53:39 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-01-06 00:53:39 +0000
commit5f153476311b368e80c57c4d1051c8106a724118 (patch)
tree830e9a7198df466eb4568e5a790d99b4cd1a6143 /eclass/python-utils-r1.eclass
parent17ad5d72e60411f0ed843a9dbeb450d89f63d62c (diff)
gentoo auto-resync : 06:01:2024 - 00:53:38
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass29
1 files changed, 28 insertions, 1 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index abb55bd2e942..3af3cbdb075e 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -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