summaryrefslogtreecommitdiff
blob: 4c7892fbc93a9dbb7becc64ae7b04c5b2ee4e197 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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