distutils-r1.eclass: Switch test deps to PYTHON_MULTI_USEDEP
authorMichał Górny <mgorny@gentoo.org>
Fri, 7 Feb 2020 11:54:13 +0000 (12:54 +0100)
committerMichał Górny <mgorny@gentoo.org>
Sun, 9 Feb 2020 16:10:25 +0000 (17:10 +0100)
Closes: https://bugs.gentoo.org/704522
Signed-off-by: Michał Górny <mgorny@gentoo.org>
eclass/distutils-r1.eclass

index 3d6866b8db5f226da18afd831f50246de86650a1..e546aadfa4a7028d4d38400bc65090ca78394e9d 100644 (file)
@@ -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_cond_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