Closes: https://bugs.gentoo.org/704522
Signed-off-by: Michał Górny <mgo...@gentoo.org>
---
 eclass/distutils-r1.eclass | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 3d6866b8db5f..2738340d5e26 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -395,16 +395,16 @@ distutils_enable_tests() {
        debug-print-function ${FUNCNAME} "${@}"
        [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: 
test-runner"
 
-       local test_deps
+       local test_pkg
        case ${1} in
                nose)
-                       test_deps="dev-python/nose[${PYTHON_USEDEP}]"
+                       test_pkg="dev-python/nose"
                        python_test() {
                                nosetests -v || die "Tests fail with ${EPYTHON}"
                        }
                        ;;
                pytest)
-                       test_deps="dev-python/pytest[${PYTHON_USEDEP}]"
+                       test_pkg="dev-python/pytest"
                        python_test() {
                                pytest -vv || die "Tests fail with ${EPYTHON}"
                        }
@@ -424,13 +424,23 @@ distutils_enable_tests() {
                        die "${FUNCNAME}: unsupported argument: ${1}"
        esac
 
-       if [[ -n ${test_deps} || -n ${RDEPEND} ]]; then
+       local test_deps=${RDEPEND}
+       if [[ -n ${test_pkg} ]]; then
+               if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+                       test_deps+=" ${test_pkg}[${PYTHON_USEDEP}]"
+               else
+                       test_deps+=" $(python_gen_any_dep '
+                               ${test_pkg}[${PYTHON_MULTI_USEDEP}]
+                       ')"
+               fi
+       fi
+       if [[ -n ${test_deps} ]]; then
                IUSE+=" test"
                RESTRICT+=" !test? ( test )"
                if [[ ${EAPI} == [56] ]]; then
-                       DEPEND+=" test? ( ${test_deps} ${RDEPEND} )"
+                       DEPEND+=" test? ( ${test_deps} )"
                else
-                       BDEPEND+=" test? ( ${test_deps} ${RDEPEND} )"
+                       BDEPEND+=" test? ( ${test_deps} )"
                fi
        fi
 
-- 
2.25.0


Reply via email to