diff options
author | Michał Górny <mgorny@gentoo.org> | 2024-07-16 18:21:09 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2024-07-22 17:09:32 +0200 |
commit | 80a7960b9faa73152efd81e316f1083644817a02 (patch) | |
tree | 414799e27971320ab4644d746f02fde2fb8a7d42 /eclass | |
parent | distutils-r1.eclass: Allow wheel reuse by default (diff) | |
download | gentoo-80a7960b9faa73152efd81e316f1083644817a02.tar.gz gentoo-80a7960b9faa73152efd81e316f1083644817a02.tar.bz2 gentoo-80a7960b9faa73152efd81e316f1083644817a02.zip |
distutils-r1.eclass: Add distutils_enable_tests import-check
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 <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/distutils-r1.eclass | 12 |
1 files changed, 11 insertions, 1 deletions
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 ;; |