* [gentoo-dev] [PATCH v2 1/2] distutils-r1.eclass: distutils_enable_tests, add 'setup.py' option
@ 2019-11-16 11:04 Michał Górny
2019-11-16 11:04 ` [gentoo-dev] [PATCH v2 2/2] distutils-r1.eclass: Add tests for distutils_enable_tests Michał Górny
0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2019-11-16 11:04 UTC (permalink / raw
To: gentoo-dev; +Cc: python, Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 6 ++++++
1 file changed, 6 insertions(+)
Changed in v2: added '--verbose' to setup.py call
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 ||
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-dev] [PATCH v2 2/2] distutils-r1.eclass: Add tests for distutils_enable_tests
2019-11-16 11:04 [gentoo-dev] [PATCH v2 1/2] distutils-r1.eclass: distutils_enable_tests, add 'setup.py' option Michał Górny
@ 2019-11-16 11:04 ` Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2019-11-16 11:04 UTC (permalink / raw
To: gentoo-dev; +Cc: python, Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/tests/distutils-r1.sh | 67 +++++++++++++++++++++++++++++++++++-
1 file changed, 66 insertions(+), 1 deletion(-)
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
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-16 11:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-16 11:04 [gentoo-dev] [PATCH v2 1/2] distutils-r1.eclass: distutils_enable_tests, add 'setup.py' option Michał Górny
2019-11-16 11:04 ` [gentoo-dev] [PATCH v2 2/2] distutils-r1.eclass: Add tests for distutils_enable_tests Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox