1 |
Do not set IUSE or other variables if the test runner does not have |
2 |
any deps, and RDEPEND is empty. |
3 |
|
4 |
Signed-off-by: Michał Górny <mgorny@g.o> |
5 |
--- |
6 |
eclass/distutils-r1.eclass | 23 ++++++++++++----------- |
7 |
1 file changed, 12 insertions(+), 11 deletions(-) |
8 |
|
9 |
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass |
10 |
index 99da6f5111cd..f316f85c3fc8 100644 |
11 |
--- a/eclass/distutils-r1.eclass |
12 |
+++ b/eclass/distutils-r1.eclass |
13 |
@@ -255,21 +255,16 @@ distutils_enable_tests() { |
14 |
debug-print-function ${FUNCNAME} "${@}" |
15 |
[[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: test-runner" |
16 |
|
17 |
- [[ ${EAPI} == [56] ]] && local BDEPEND |
18 |
- |
19 |
- IUSE+=" test" |
20 |
- RESTRICT+=" !test? ( test )" |
21 |
- BDEPEND+=" test? (" |
22 |
- |
23 |
+ local test_deps |
24 |
case ${1} in |
25 |
nose) |
26 |
- BDEPEND+=" dev-python/nose[${PYTHON_USEDEP}]" |
27 |
+ test_deps="dev-python/nose[${PYTHON_USEDEP}]" |
28 |
python_test() { |
29 |
nosetests -v || die "Tests fail with ${EPYTHON}" |
30 |
} |
31 |
;; |
32 |
pytest) |
33 |
- BDEPEND+=" dev-python/pytest[${PYTHON_USEDEP}]" |
34 |
+ test_deps="dev-python/pytest[${PYTHON_USEDEP}]" |
35 |
python_test() { |
36 |
pytest -vv || die "Tests fail with ${EPYTHON}" |
37 |
} |
38 |
@@ -289,9 +284,15 @@ distutils_enable_tests() { |
39 |
die "${FUNCNAME}: unsupported argument: ${1}" |
40 |
esac |
41 |
|
42 |
- BDEPEND+=" ${RDEPEND} )" |
43 |
- |
44 |
- [[ ${EAPI} == [56] ]] && DEPEND+=" ${BDEPEND}" |
45 |
+ if [[ -n ${test_deps} || -n ${RDEPEND} ]]; then |
46 |
+ IUSE+=" test" |
47 |
+ RESTRICT+=" !test? ( test )" |
48 |
+ if [[ ${EAPI} == [56] ]]; then |
49 |
+ DEPEND+=" test? ( ${test_deps} ${RDEPEND} )" |
50 |
+ else |
51 |
+ BDEPEND+=" test? ( ${test_deps} ${RDEPEND} )" |
52 |
+ fi |
53 |
+ fi |
54 |
|
55 |
# we need to ensure successful return in case we're called last, |
56 |
# otherwise Portage may wrongly assume sourcing failed |
57 |
-- |
58 |
2.24.0 |