summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-11-03 20:16:30 +0100
committerMichał Górny <mgorny@gentoo.org>2023-11-07 06:29:07 +0100
commitefb3420408bcf988abe78f92ab8aa93069dba566 (patch)
treecc50484b6b8611f473e81c3b3c773e6699ea9535 /eclass
parentpython-utils-r1.eclass: Add EPYTEST_XDIST for epytest (diff)
downloadgentoo-efb3420408bcf988abe78f92ab8aa93069dba566.tar.gz
gentoo-efb3420408bcf988abe78f92ab8aa93069dba566.tar.bz2
gentoo-efb3420408bcf988abe78f92ab8aa93069dba566.zip
distutils-r1.eclass: Add pytest-xdist dep if EPYTEST_XDIST is set
Make `distutils_enable_tests pytest` automatically add the `dev-python/pytest-xdist` dependency if `EPYTEST_XDIST` is set. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/distutils-r1.eclass3
-rw-r--r--eclass/python-utils-r1.eclass4
2 files changed, 6 insertions, 1 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 3d69911d9209..3d756eaad556 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -617,6 +617,9 @@ distutils_enable_tests() {
;;
pytest)
test_pkgs='>=dev-python/pytest-7.3.1[${PYTHON_USEDEP}]'
+ if [[ ${EPYTEST_XDIST} ]]; then
+ test_pkgs+=' dev-python/pytest-xdist[${PYTHON_USEDEP}]'
+ fi
;;
setup.py)
;;
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 48963728cc2f..80abe974f9df 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1311,7 +1311,9 @@ _python_check_occluded_packages() {
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set to a non-empty value, enables running tests in parallel
-# via pytest-xdist plugin.
+# via pytest-xdist plugin. If this variable is set prior to calling
+# distutils_enable_tests in distutils-r1, a test dependency
+# on dev-python/pytest-xdist is added automatically.
# @ECLASS_VARIABLE: EPYTEST_JOBS
# @USER_VARIABLE