summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-11-15 17:34:45 +0100
committerMichał Górny <mgorny@gentoo.org>2019-11-20 08:44:04 +0100
commitdab1b0137f4fd5f91dab6dafe8a4c130a28290f3 (patch)
treefac68dd44be1ea988092e08d11affb5e7a1d06fd /eclass
parentdistutils-r1.eclass: distutils_enable_tests, add 'setup.py' option (diff)
downloadgentoo-dab1b0137f4fd5f91dab6dafe8a4c130a28290f3.tar.gz
gentoo-dab1b0137f4fd5f91dab6dafe8a4c130a28290f3.tar.bz2
gentoo-dab1b0137f4fd5f91dab6dafe8a4c130a28290f3.zip
distutils-r1.eclass: Add tests for distutils_enable_tests
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rwxr-xr-xeclass/tests/distutils-r1.sh67
1 files changed, 66 insertions, 1 deletions
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