mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-05 14:07:27 -08:00
python-utils-r1.eclass: Add EPYTEST_RERUNS
Add EPYTEST_RERUNS variable to enable pytest-rerunfailures with a specified rerun count. This should provide a more streamlined approach to handling flaky test suites. Signed-off-by: Michał Górny <mgorny@gentoo.org> Part-of: https://github.com/gentoo/gentoo/pull/43094 Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
parent
44639f1f78
commit
87a034bd84
@ -554,6 +554,9 @@ distutils_enable_tests() {
|
||||
;&
|
||||
pytest)
|
||||
test_pkgs+=' >=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]'
|
||||
if [[ -n ${EPYTEST_RERUNS} ]]; then
|
||||
test_pkgs+=' dev-python/pytest-rerunfailures[${PYTHON_USEDEP}]'
|
||||
fi
|
||||
if [[ -n ${EPYTEST_TIMEOUT} ]]; then
|
||||
test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]'
|
||||
fi
|
||||
|
||||
@ -1354,6 +1354,16 @@ _set_epytest_plugins() {
|
||||
fi
|
||||
}
|
||||
|
||||
# @ECLASS_VARIABLE: EPYTEST_RERUNS
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# If set to a non-empty value, enables pytest-rerunfailures plugin
|
||||
# and sets rerun count to the specified value. This variable can be
|
||||
# either set in ebuilds with flaky tests, or by user to try if it helps.
|
||||
# If this variable is set prior to calling distutils_enable_tests
|
||||
# in distutils-r1, a test dependency on dev-python/pytest-rerunfailures
|
||||
# is added automatically.
|
||||
|
||||
# @ECLASS_VARIABLE: EPYTEST_TIMEOUT
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
@ -1517,6 +1527,18 @@ epytest() {
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ -n ${EPYTEST_RERUNS} ]]; then
|
||||
if [[ ${PYTEST_PLUGINS} != *pytest_rerunfailures* ]]; then
|
||||
args+=(
|
||||
-p rerunfailures
|
||||
)
|
||||
fi
|
||||
|
||||
args+=(
|
||||
"--reruns=${EPYTEST_RERUNS}"
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ -n ${EPYTEST_TIMEOUT} ]]; then
|
||||
if [[ ${PYTEST_PLUGINS} != *pytest_timeout* ]]; then
|
||||
args+=(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user