diff options
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/Manifest.gz | bin | 38933 -> 38935 bytes | |||
-rw-r--r-- | eclass/distutils-r1.eclass | 8 | ||||
-rw-r--r-- | eclass/python-utils-r1.eclass | 29 |
3 files changed, 35 insertions, 2 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz Binary files differindex 3bf4b0ca03e4..8d328ba22304 100644 --- a/eclass/Manifest.gz +++ b/eclass/Manifest.gz diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 5a99ba88eddb..c0d1992ccce0 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-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: distutils-r1.eclass @@ -618,6 +618,9 @@ distutils_enable_tests() { ;; pytest) test_pkgs='>=dev-python/pytest-7.3.1[${PYTHON_USEDEP}]' + if [[ -n ${EPYTEST_TIMEOUT} ]]; then + test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]' + fi if [[ ${EPYTEST_XDIST} ]]; then test_pkgs+=' dev-python/pytest-xdist[${PYTHON_USEDEP}]' fi @@ -1401,6 +1404,9 @@ distutils_pep517_install() { ) ;; setuptools) + if in_iuse debug && use debug; then + local -x SETUPTOOLS_RUST_CARGO_PROFILE=dev + fi if [[ -n ${DISTUTILS_ARGS[@]} ]]; then config_settings=$( "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die 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 |