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: metadata/install-qa-check.d/
Date: Sat, 29 May 2021 15:15:50
Message-Id: 1622301343.4bfa549af9709682d530782d068d72c43a709e62.mgorny@gentoo
1 commit: 4bfa549af9709682d530782d068d72c43a709e62
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 29 11:45:45 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat May 29 15:15:43 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4bfa549a
7
8 install-qa-check.d: Check for missing tests in distutils-r1 ebuilds
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 metadata/install-qa-check.d/60python-tests | 32 ++++++++++++++++++++++++++++++
13 1 file changed, 32 insertions(+)
14
15 diff --git a/metadata/install-qa-check.d/60python-tests b/metadata/install-qa-check.d/60python-tests
16 new file mode 100644
17 index 00000000000..713ed63d376
18 --- /dev/null
19 +++ b/metadata/install-qa-check.d/60python-tests
20 @@ -0,0 +1,32 @@
21 +# Copyright 2021 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +# QA check: ensure that tests are run if present
25 +# Maintainer: Python project <python@g.o>
26 +
27 +python_test_check() {
28 + # only distutils-r1 is covered for the time being
29 + has distutils-r1 ${INHERITED} || return
30 + # skip packages that define tests
31 + declare -p -f python_test &>/dev/null && return
32 + # skip packages that explicitly restrict tests
33 + has test ${RESTRICT} && return
34 +
35 + # do we have any files looking like tests?
36 + local any=$(find "${WORKDIR}" -name 'test_*.py' -print -quit)
37 + [[ -n ${any} ]] || return
38 +
39 + eqawarn
40 + eqawarn 'QA Notice: this package seems to contain tests but they are not enabled.'
41 + eqawarn 'Please either run tests (via distutils_enable_tests or declaring'
42 + eqawarn 'python_test yourself), or add RESTRICT="test" along with an explanatory'
43 + eqawarn 'comment if tests cannot be run.'
44 + eqawarn
45 + eqatag -v python-tests.missing
46 +}
47 +
48 +python_test_check
49 +
50 +: # guarantee successful exit
51 +
52 +# vim:ft=ebuild