summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRepository mirror & CI <repomirrorci@gentoo.org>2019-11-20 08:09:38 +0000
committerRepository mirror & CI <repomirrorci@gentoo.org>2019-11-20 08:09:38 +0000
commit462a05672d2c88905ddba5722b6a53401f06b4a7 (patch)
treecd0c22aaab63f3fcf7337f6083409325289f13bf
parent2019-11-20 07:46:08 UTC (diff)
parentdistutils-r1.eclass: Add tests for distutils_enable_tests (diff)
downloadgentoo-462a05672d2c88905ddba5722b6a53401f06b4a7.tar.gz
gentoo-462a05672d2c88905ddba5722b6a53401f06b4a7.tar.bz2
gentoo-462a05672d2c88905ddba5722b6a53401f06b4a7.zip
Merge updates from master
-rw-r--r--dev-tcltk/tktray/tktray-1.3.9.ebuild3
-rw-r--r--eclass/distutils-r1.eclass6
-rwxr-xr-xeclass/tests/distutils-r1.sh67
3 files changed, 74 insertions, 2 deletions
diff --git a/dev-tcltk/tktray/tktray-1.3.9.ebuild b/dev-tcltk/tktray/tktray-1.3.9.ebuild
index 8b1b102c4bca..3cb9eb4b38ab 100644
--- a/dev-tcltk/tktray/tktray-1.3.9.ebuild
+++ b/dev-tcltk/tktray/tktray-1.3.9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
@@ -15,6 +15,7 @@ LICENSE="tcltk"
SLOT="0"
KEYWORDS="amd64 ~ppc ~sparc x86"
IUSE="debug threads test"
+RESTRICT="!test? ( test )"
DEPEND="
>=dev-lang/tcl-8.4:0=
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index e2cd076d4148..63e77bf014c1 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -241,6 +241,7 @@ fi
#
# - nose: nosetests (dev-python/nose)
# - pytest: dev-python/pytest
+# - setup.py: setup.py test (no deps included)
# - unittest: for built-in Python unittest module
#
# This function is meant as a helper for common use cases, and it only
@@ -268,6 +269,11 @@ distutils_enable_tests() {
pytest -vv || die "Tests fail with ${EPYTHON}"
}
;;
+ setup.py)
+ python_test() {
+ esetup.py test --verbose
+ }
+ ;;
unittest)
python_test() {
"${EPYTHON}" -m unittest discover -v ||
diff --git a/eclass/tests/distutils-r1.sh b/eclass/tests/distutils-r1.sh
index d557f6cad534..d5f3e2812ca4 100755
--- a/eclass/tests/distutils-r1.sh
+++ b/eclass/tests/distutils-r1.sh
@@ -17,6 +17,36 @@ test-phase_name_free() {
fi
}
+test-distutils_enable_tests() {
+ local runner=${1}
+ local exp_IUSE=${2}
+ local exp_RESTRICT=${3}
+ local exp_DEPEND=${4}
+
+ local IUSE=${IUSE}
+ local RESTRICT=${RESTRICT}
+ local DEPEND=${DEPEND}
+
+ tbegin "${runner}"
+
+ distutils_enable_tests "${runner}"
+
+ local ret var
+ for var in IUSE RESTRICT DEPEND; do
+ local exp_var=exp_${var}
+ if [[ ${!var} != "${!exp_var}" ]]; then
+ eindent
+ eerror "${var} expected: ${!exp_var}"
+ eerror "${var} actual: ${!var}"
+ eoutdent
+ ret=1
+ tret=1
+ fi
+ done
+
+ tend ${ret}
+}
+
inherit distutils-r1
tbegin "sane function names"
@@ -27,6 +57,41 @@ test-phase_name_free python_compile
test-phase_name_free python_test
test-phase_name_free python_install
-tend ${failed}
+tend
+
+einfo distutils_enable_tests
+eindent
+BASE_IUSE="python_targets_python2_7"
+BASE_DEPS="python_targets_python2_7? ( >=dev-lang/python-2.7.5-r2:2.7 ) >=dev-lang/python-exec-2:=[python_targets_python2_7(-)?,-python_single_target_python2_7(-)]"
+TEST_RESTRICT=" !test? ( test )"
+
+einfo "empty RDEPEND"
+eindent
+RDEPEND=""
+test-distutils_enable_tests pytest \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] )"
+test-distutils_enable_tests nose \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] )"
+test-distutils_enable_tests unittest \
+ "${BASE_IUSE}" "" "${BASE_DEPS}"
+test-distutils_enable_tests setup.py \
+ "${BASE_IUSE}" "" "${BASE_DEPS}"
+eoutdent
+
+einfo "non-empty RDEPEND"
+eindent
+BASE_RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
+RDEPEND=${BASE_RDEPEND}
+test-distutils_enable_tests pytest \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/pytest[${PYTHON_USEDEP}] ${BASE_RDEPEND} )"
+test-distutils_enable_tests nose \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( dev-python/nose[${PYTHON_USEDEP}] ${BASE_RDEPEND} )"
+test-distutils_enable_tests unittest \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
+test-distutils_enable_tests setup.py \
+ "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
+eoutdent
+
+eoutdent
texit