commit:     17d6502b0285cf9e6695b19a6198c38de62a7ca7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 31 00:22:26 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 31 00:22:26 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17d6502b

dev-python/mpmath: fix tests w/ <numpy-2

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

 .../files/mpmath-1.4.0_alpha2-before-numpy-2.patch | 22 ++++++++++++++++++++++
 dev-python/mpmath/mpmath-1.4.0_alpha2.ebuild       |  4 ++++
 2 files changed, 26 insertions(+)

diff --git a/dev-python/mpmath/files/mpmath-1.4.0_alpha2-before-numpy-2.patch 
b/dev-python/mpmath/files/mpmath-1.4.0_alpha2-before-numpy-2.patch
new file mode 100644
index 000000000000..bd8674118038
--- /dev/null
+++ b/dev-python/mpmath/files/mpmath-1.4.0_alpha2-before-numpy-2.patch
@@ -0,0 +1,22 @@
+https://github.com/mpmath/mpmath/pull/878
+https://github.com/mpmath/mpmath/commit/728db99cd92dde589dc0cbe89f7f3f444af046ad
+
+From 9dd08e59dff0a0992b92d31e4f614e43881b301d Mon Sep 17 00:00:00 2001
+From: Doug Torrance <[email protected]>
+Date: Tue, 15 Oct 2024 18:48:40 -0400
+Subject: [PATCH] Only check for NumPy array copy ValueError w/ NumPy >= 2.0
+
+No such error is raised when using NumPy < 2.0.
+--- a/mpmath/tests/test_matrices.py
++++ b/mpmath/tests/test_matrices.py
+@@ -203,7 +203,8 @@ def test_matrix_numpy():
+ 
+     if sys.version_info < (3, 9):
+         pytest.skip("latest numpy dropped support for CPython 3.8")
+-    pytest.raises(ValueError, lambda: numpy.array(matrix(l), copy=False))
++    if numpy.__version__ >= '2':
++        pytest.raises(ValueError, lambda: numpy.array(matrix(l), copy=False))
+ 
+ def test_interval_matrix_scalar_mult():
+     """Multiplication of iv.matrix and any scalar type"""
+

diff --git a/dev-python/mpmath/mpmath-1.4.0_alpha2.ebuild 
b/dev-python/mpmath/mpmath-1.4.0_alpha2.ebuild
index 3b8f25219022..e40d8544179e 100644
--- a/dev-python/mpmath/mpmath-1.4.0_alpha2.ebuild
+++ b/dev-python/mpmath/mpmath-1.4.0_alpha2.ebuild
@@ -40,6 +40,10 @@ BDEPEND="
        )
 "
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4.0_alpha2-before-numpy-2.patch
+)
+
 EPYTEST_XDIST=1
 distutils_enable_tests pytest
 

Reply via email to