Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/tests/
Date: Thu, 02 Jul 2020 08:29:34
Message-Id: 1593678556.edbad14a5a79e4972092707475ee3cf00e3b07ca.mgorny@gentoo
1 commit: edbad14a5a79e4972092707475ee3cf00e3b07ca
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 2 07:28:04 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 2 08:29:16 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=edbad14a
7
8 eclass/tests/distutils-r1:single.sh: Tests for d-r1 single impl mode
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 eclass/tests/distutils-r1_single.sh | 81 +++++++++++++++++++++++++++++++++++++
13 1 file changed, 81 insertions(+)
14
15 diff --git a/eclass/tests/distutils-r1_single.sh b/eclass/tests/distutils-r1_single.sh
16 new file mode 100755
17 index 00000000000..6c79e36881b
18 --- /dev/null
19 +++ b/eclass/tests/distutils-r1_single.sh
20 @@ -0,0 +1,81 @@
21 +#!/bin/bash
22 +# Copyright 1999-2020 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=7
26 +PYTHON_COMPAT=( python3_8 )
27 +source tests-common.sh
28 +
29 +test-distutils_enable_tests() {
30 + local runner=${1}
31 + local exp_IUSE=${2}
32 + local exp_RESTRICT=${3}
33 + local exp_BDEPEND=${4}
34 +
35 + local IUSE=${IUSE}
36 + local RESTRICT=${RESTRICT}
37 + local BDEPEND=${BDEPEND}
38 +
39 + tbegin "${runner}"
40 +
41 + distutils_enable_tests "${runner}"
42 +
43 + local ret var
44 + for var in IUSE RESTRICT BDEPEND; do
45 + local exp_var=exp_${var}
46 + # (this normalizes whitespace)
47 + read -d $'\0' -r -a val <<<"${!var}"
48 + val=${val[*]}
49 + if [[ ${val} != "${!exp_var}" ]]; then
50 + eindent
51 + eerror "${var} expected: ${!exp_var}"
52 + eerror "${var} actual: ${val}"
53 + eoutdent
54 + ret=1
55 + tret=1
56 + fi
57 + done
58 +
59 + tend ${ret}
60 +}
61 +
62 +DISTUTILS_USE_SETUPTOOLS=no
63 +DISTUTILS_SINGLE_IMPL=1
64 +inherit distutils-r1
65 +
66 +einfo distutils_enable_tests
67 +eindent
68 +BASE_IUSE="+python_single_target_python3_8"
69 +BASE_DEPS="python_single_target_python3_8? ( dev-lang/python:3.8 >=dev-lang/python-exec-2:=[python_targets_python3_8] )"
70 +TEST_RESTRICT="!test? ( test )"
71 +
72 +einfo "empty RDEPEND"
73 +eindent
74 +RDEPEND=""
75 +test-distutils_enable_tests pytest \
76 + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( python_single_target_python3_8? ( >=dev-python/pytest-4.5.0[python_targets_python3_8(-)] ) )"
77 +test-distutils_enable_tests nose \
78 + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( python_single_target_python3_8? ( >=dev-python/nose-1.3.7-r4[python_targets_python3_8(-)] ) )"
79 +test-distutils_enable_tests unittest \
80 + "${BASE_IUSE}" "" "${BASE_DEPS}"
81 +test-distutils_enable_tests setup.py \
82 + "${BASE_IUSE}" "" "${BASE_DEPS}"
83 +eoutdent
84 +
85 +einfo "non-empty RDEPEND"
86 +eindent
87 +BASE_RDEPEND="dev-python/foo[${PYTHON_SINGLE_USEDEP}]"
88 +RDEPEND=${BASE_RDEPEND}
89 +test-distutils_enable_tests pytest \
90 + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} python_single_target_python3_8? ( >=dev-python/pytest-4.5.0[python_targets_python3_8(-)] ) )"
91 +test-distutils_enable_tests nose \
92 + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} python_single_target_python3_8? ( >=dev-python/nose-1.3.7-r4[python_targets_python3_8(-)] ) )"
93 +test-distutils_enable_tests unittest \
94 + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
95 +test-distutils_enable_tests setup.py \
96 + "${BASE_IUSE} test" "${TEST_RESTRICT}" "${BASE_DEPS} test? ( ${BASE_RDEPEND} )"
97 +eoutdent
98 +
99 +eoutdent
100 +
101 +texit