commit:     7c860ea869f2c35cd24f828929bfdd1111198efe
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 25 01:31:08 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov 25 01:31:55 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c860ea8

dev-python/scipy: use pytest (again)

- Fixes tests with Python 3.10 (avoids a DeprecationWarning in distutils)
- Try to use pytest-xdist again to speed things up. Seems to work now
  and be a bit faster (although it wasn't clear it was faster in the past
  for others).

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-python/scipy/scipy-1.7.3.ebuild | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/dev-python/scipy/scipy-1.7.3.ebuild 
b/dev-python/scipy/scipy-1.7.3.ebuild
index cdc137b1517c..41599657a4ed 100644
--- a/dev-python/scipy/scipy-1.7.3.ebuild
+++ b/dev-python/scipy/scipy-1.7.3.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 PYTHON_COMPAT=( python3_{8..10} )
 PYTHON_REQ_USE="threads(+)"
 
-inherit fortran-2 distutils-r1 flag-o-matic toolchain-funcs
+inherit fortran-2 distutils-r1 flag-o-matic multiprocessing toolchain-funcs
 
 # upstream is slacking forever with doc updates
 DOC_PV=1.7.1
@@ -41,6 +41,7 @@ BDEPEND="
        pythran? ( dev-python/pythran[${PYTHON_USEDEP}] )
        test? (
                dev-python/nose[${PYTHON_USEDEP}]
+               dev-python/pytest-xdist[${PYTHON_USEDEP}]
        )"
 
 DISTUTILS_IN_SOURCE_BUILD=1
@@ -149,6 +150,7 @@ python_configure_all() {
 
 python_compile() {
        # FIXME: parallel python building fails, bug #614464
+       export ORIGINAL_MAKEOPTS="${MAKEOPTS}"
        export MAKEOPTS=-j1
 
        ${EPYTHON} tools/cythonize.py || die
@@ -160,10 +162,17 @@ python_test() {
        # fails with bdist_egg. should it be fixed in distutils-r1 eclass?
        distutils_install_for_testing ${SCIPY_FCONFIG}
        cd "${TEST_DIR}/lib" || die "no ${TEST_DIR} available"
-       PYTHONPATH=. "${EPYTHON}" -c "
-import scipy, sys
-r = scipy.test('fast', verbose=2)
-sys.exit(0 if r else 1)" || die "Tests fail with ${EPYTHON}"
+
+       # Let's try using pytest again with xdist to speed things up.
+       # Note that using pytest is required to avoid dying b/c of a
+       # deprecation warning with distutils in Python 3.01.
+       epytest -n "$(makeopts_jobs "${ORIGINAL_MAKEOPTS}" "$(get_nproc)")"
+
+       # Old test runner
+#      PYTHONPATH=. "${EPYTHON}" -c "
+#import scipy, sys
+#r = scipy.test('fast', verbose=2)
+#sys.exit(0 if r else 1)" || die "Tests fail with ${EPYTHON}"
 }
 
 python_install_all() {

Reply via email to