commit:     efb3420408bcf988abe78f92ab8aa93069dba566
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  3 19:16:30 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Nov  7 05:29:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=efb34204

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 <AT> gentoo.org>

 eclass/distutils-r1.eclass    | 3 +++
 eclass/python-utils-r1.eclass | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

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

Reply via email to