summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-11-15 17:16:34 +0100
committerMichał Górny <mgorny@gentoo.org>2019-11-16 12:00:39 +0100
commite26c93b0e889c06d28bfc8defe7acaef971ee435 (patch)
treeb2066d2d4255ec34f5acdabb20cbdce68be3353a /eclass/distutils-r1.eclass
parentsys-apps/shadow: Revbump to re-add split-usr (diff)
downloadgentoo-e26c93b0e889c06d28bfc8defe7acaef971ee435.tar.gz
gentoo-e26c93b0e889c06d28bfc8defe7acaef971ee435.tar.bz2
gentoo-e26c93b0e889c06d28bfc8defe7acaef971ee435.zip
distutils-r1.eclass: distutils_enable_tests, handle no deps better
Do not set IUSE or other variables if the test runner does not have any deps, and RDEPEND is empty. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass23
1 files changed, 12 insertions, 11 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 2edffdb2d7c5..e2cd076d4148 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -254,21 +254,16 @@ distutils_enable_tests() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: test-runner"
- [[ ${EAPI} == [56] ]] && local BDEPEND
-
- IUSE+=" test"
- RESTRICT+=" !test? ( test )"
- BDEPEND+=" test? ("
-
+ local test_deps
case ${1} in
nose)
- BDEPEND+=" dev-python/nose[${PYTHON_USEDEP}]"
+ test_deps="dev-python/nose[${PYTHON_USEDEP}]"
python_test() {
nosetests -v || die "Tests fail with ${EPYTHON}"
}
;;
pytest)
- BDEPEND+=" dev-python/pytest[${PYTHON_USEDEP}]"
+ test_deps="dev-python/pytest[${PYTHON_USEDEP}]"
python_test() {
pytest -vv || die "Tests fail with ${EPYTHON}"
}
@@ -283,9 +278,15 @@ distutils_enable_tests() {
die "${FUNCNAME}: unsupported argument: ${1}"
esac
- BDEPEND+=" ${RDEPEND} )"
-
- [[ ${EAPI} == [56] ]] && DEPEND+=" ${BDEPEND}"
+ if [[ -n ${test_deps} || -n ${RDEPEND} ]]; then
+ IUSE+=" test"
+ RESTRICT+=" !test? ( test )"
+ if [[ ${EAPI} == [56] ]]; then
+ DEPEND+=" test? ( ${test_deps} ${RDEPEND} )"
+ else
+ BDEPEND+=" test? ( ${test_deps} ${RDEPEND} )"
+ fi
+ fi
# we need to ensure successful return in case we're called last,
# otherwise Portage may wrongly assume sourcing failed