From 4bfa549af9709682d530782d068d72c43a709e62 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 29 May 2021 13:45:45 +0200 Subject: install-qa-check.d: Check for missing tests in distutils-r1 ebuilds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- metadata/install-qa-check.d/60python-tests | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 metadata/install-qa-check.d/60python-tests (limited to 'metadata') 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_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 -- cgit v1.2.3-65-gdbad