commit: 61febafe65f875bad8fa868bdcfad4b5ba448fbe Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Mar 1 08:15:08 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sat Mar 1 08:16:39 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=61febafe
dev-python/pytest-cov: Fix tests Closes: https://bugs.gentoo.org/889886 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> dev-python/pytest-cov/pytest-cov-6.0.0.ebuild | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/dev-python/pytest-cov/pytest-cov-6.0.0.ebuild b/dev-python/pytest-cov/pytest-cov-6.0.0.ebuild index 7a0c80e7d268..c03e424ab078 100644 --- a/dev-python/pytest-cov/pytest-cov-6.0.0.ebuild +++ b/dev-python/pytest-cov/pytest-cov-6.0.0.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -7,7 +7,7 @@ DISTUTILS_USE_PEP517=setuptools PYPI_NO_NORMALIZE=1 PYTHON_COMPAT=( python3_{10..12} pypy3 ) -inherit distutils-r1 multiprocessing pypi +inherit distutils-r1 pypi DESCRIPTION="pytest plugin for coverage reporting" HOMEPAGE=" @@ -24,12 +24,13 @@ RDEPEND=" >=dev-python/pytest-3.6[${PYTHON_USEDEP}] >=dev-python/coverage-6.4.4-r1[${PYTHON_USEDEP}] " +# NB: xdist is also used directly in the test suite BDEPEND=" test? ( - dev-python/virtualenv[${PYTHON_USEDEP}] dev-python/fields[${PYTHON_USEDEP}] >=dev-python/process-tests-2.0.2[${PYTHON_USEDEP}] dev-python/pytest-xdist[${PYTHON_USEDEP}] + dev-python/virtualenv[${PYTHON_USEDEP}] ) " @@ -39,6 +40,7 @@ PATCHES=( distutils_enable_sphinx docs \ dev-python/furo +EPYTEST_XDIST=1 distutils_enable_tests pytest python_test() { @@ -46,18 +48,14 @@ python_test() { local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 local -x PYTEST_PLUGINS=pytest_cov.plugin,xdist.plugin,xdist.looponfail - local src=$( - "${EPYTHON}" -c "import coverage as m; print(*m.__path__)" || die - ) - # TODO: why do we need to do that?! # https://github.com/pytest-dev/pytest-cov/issues/517 - ln -s "${src}" \ - "${BUILD_DIR}/install$(python_get_sitedir)/coverage" || die - - nonfatal epytest -n "$(makeopts_jobs)" --dist=worksteal - local ret=${?} - - rm "${BUILD_DIR}/install$(python_get_sitedir)/coverage" || die + local -x PYTHONPATH=$(python_get_sitedir):${PYTHONPATH} + local EPYTEST_DESELECT=( + # this one's broken by the PYTHONPATH hack + # the alternative is to symlink coverage and pytest into venv, + # but that's ugly and likely to break again in the future + tests/test_pytest_cov.py::test_central_subprocess_change_cwd_with_pythonpath + ) - [[ ${ret} -ne 0 ]] && die "epytest failed on ${EPYTHON}" + epytest }
