From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 14443158170 for ; Fri, 19 Jul 2024 15:05:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 674082BC044; Fri, 19 Jul 2024 15:04:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E81EF2BC041 for ; Fri, 19 Jul 2024 15:04:35 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 3/6] distutils-r1.eclass: Add distutils_enable_tests import-check Date: Fri, 19 Jul 2024 16:56:03 +0200 Message-ID: <20240719150427.133877-4-mgorny@gentoo.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240719150427.133877-1-mgorny@gentoo.org> References: <20240719150427.133877-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 7eacae94-7e54-4efe-911e-498c49a56a48 X-Archives-Hash: 1e1c97500555e354c2e596c153293d24 Add support for using the dev-python/pytest-import-check plugin to test if all modules installed by the package can be imported. Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 645b5df5a6e5..fa8edb5cdfb7 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -572,6 +572,9 @@ distutils_enable_sphinx() { # with the specified test runner. Also copies the current value # of RDEPEND to test?-BDEPEND. The test-runner argument must be one of: # +# - import-check: `pytest --import-check` fallback (for use when there are +# no tests to run) +# # - pytest: dev-python/pytest # # - setup.py: setup.py test (no deps included) @@ -597,9 +600,13 @@ distutils_enable_tests() { [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: test-runner" local test_deps=${RDEPEND} + local test_pkgs= case ${1} in + import-check) + test_pkgs+=' dev-python/pytest-import-check[${PYTHON_USEDEP}]' + ;& pytest) - local test_pkgs='>=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]' + test_pkgs+=' >=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]' if [[ -n ${EPYTEST_TIMEOUT} ]]; then test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]' fi @@ -1560,6 +1567,9 @@ distutils-r1_python_test() { _python_check_EPYTHON case ${_DISTUTILS_TEST_RUNNER} in + import-check) + epytest --import-check "${BUILD_DIR}/install$(python_get_sitedir)" + ;; pytest) epytest ;; -- 2.45.2