summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-05-29 13:45:45 +0200
committerMichał Górny <mgorny@gentoo.org>2021-05-29 17:15:43 +0200
commit4bfa549af9709682d530782d068d72c43a709e62 (patch)
tree9f6a5571167ca90cfc7ac80dc308df3f78dab7eb /metadata/install-qa-check.d
parentwww-apps/drupal: bump versions (diff)
downloadgentoo-4bfa549af9709682d530782d068d72c43a709e62.tar.gz
gentoo-4bfa549af9709682d530782d068d72c43a709e62.tar.bz2
gentoo-4bfa549af9709682d530782d068d72c43a709e62.zip
install-qa-check.d: Check for missing tests in distutils-r1 ebuilds
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'metadata/install-qa-check.d')
-rw-r--r--metadata/install-qa-check.d/60python-tests32
1 files changed, 32 insertions, 0 deletions
diff --git a/metadata/install-qa-check.d/60python-tests b/metadata/install-qa-check.d/60python-tests
new file mode 100644
index 000000000000..713ed63d3764
--- /dev/null
+++ b/metadata/install-qa-check.d/60python-tests
@@ -0,0 +1,32 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# QA check: ensure that tests are run if present
+# Maintainer: Python project <python@gentoo.org>
+
+python_test_check() {
+ # only distutils-r1 is covered for the time being
+ has distutils-r1 ${INHERITED} || return
+ # skip packages that define tests
+ declare -p -f python_test &>/dev/null && return
+ # skip packages that explicitly restrict tests
+ has test ${RESTRICT} && return
+
+ # do we have any files looking like tests?
+ local any=$(find "${WORKDIR}" -name 'test_*.py' -print -quit)
+ [[ -n ${any} ]] || return
+
+ eqawarn
+ eqawarn 'QA Notice: this package seems to contain tests but they are not enabled.'
+ eqawarn 'Please either run tests (via distutils_enable_tests or declaring'
+ eqawarn 'python_test yourself), or add RESTRICT="test" along with an explanatory'
+ eqawarn 'comment if tests cannot be run.'
+ eqawarn
+ eqatag -v python-tests.missing
+}
+
+python_test_check
+
+: # guarantee successful exit
+
+# vim:ft=ebuild