diff --git a/backport-BUG-The-pytest-decorator-for-conditional-skipping-is.patch b/backport-BUG-The-pytest-decorator-for-conditional-skipping-is.patch new file mode 100644 index 0000000000000000000000000000000000000000..0dd9f38e19b57102900e06abc87e72fba9d91967 --- /dev/null +++ b/backport-BUG-The-pytest-decorator-for-conditional-skipping-is.patch @@ -0,0 +1,31 @@ +From 6ffc11362fb87c6a37b20b576832b073a12e5075 Mon Sep 17 00:00:00 2001 +From: warren +Date: Wed, 8 Dec 2021 10:13:21 -0500 +Subject: [PATCH] BUG: The pytest decorator for conditional skipping is + 'skipif' + +Reference: https://github.com/scipy/scipy/commit/beba0580ac5cb4b3525cf38b636e04c18312e748 +Conflict: context differences, dosen't have the 'darwin' item. + +--- + scipy/linalg/tests/test_decomp.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scipy/linalg/tests/test_decomp.py b/scipy/linalg/tests/test_decomp.py +index 78def78..7d02127 100644 +--- a/scipy/linalg/tests/test_decomp.py ++++ b/scipy/linalg/tests/test_decomp.py +@@ -2523,8 +2523,8 @@ def test_aligned_mem_float(): + eig(z.T, overwrite_a=True) + + +-@pytest.mark.skip(platform.machine() == 'ppc64le', +- reason="crashes on ppc64le") ++@pytest.mark.skipif(platform.machine() == 'ppc64le', ++ reason="crashes on ppc64le") + def test_aligned_mem(): + """Check linalg works with non-aligned memory (float64)""" + # Allocate 804 bytes of memory (allocated on boundary) +-- +2.33.0 + diff --git a/backport-MAINT-Replace-use-of-pytest.warns-None-with-warnings.patch b/backport-MAINT-Replace-use-of-pytest.warns-None-with-warnings.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ba274ce47c1720f6d0291d412c5cd204e6cde6f --- /dev/null +++ b/backport-MAINT-Replace-use-of-pytest.warns-None-with-warnings.patch @@ -0,0 +1,66 @@ +From 9409e5624527ed11e7caee7f0361fb0cfb0dc5b9 Mon Sep 17 00:00:00 2001 +From: warren +Date: Thu, 9 Dec 2021 12:10:05 -0500 +Subject: [PATCH] MAINT: Replace use of `pytest.warns(None)` with + `warnings.catch_warnings`. + +The use of `pytest.warns(None)` is deprecated in pytest 7.0.0. +The alternative suggested by the deprecation warning, `pytest.warns()`, +does not match the old behavior. In fact, `pytest.warns()` is intended +specifically to raise an error if the code in the context does not raise +the given warning, and in pytest 7.0.0rc1, the default warning used by +`pytest.warns()` is the generic `Warning` class. + +This issue is discussed in the following pytest issues: + +* https://github.com/pytest-dev/pytest/issues/9002 +* https://github.com/pytest-dev/pytest/issues/9386 + +There, the recommended alternative is to use `warnings.catch_warnings`. +That is the change made here. + +Closes gh-15186 + +Reference: https://github.com/scipy/scipy/commit/3f5963083e637b1eadbfeae1d8a0783c8f2c414a +Conflict: context differences, dosen't have the file scipy/fft/tests/test_fftlog.py +--- + scipy/sparse/csgraph/tests/test_shortest_path.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/scipy/sparse/csgraph/tests/test_shortest_path.py b/scipy/sparse/csgraph/tests/test_shortest_path.py +index 8412606..496a2ef 100644 +--- a/scipy/sparse/csgraph/tests/test_shortest_path.py ++++ b/scipy/sparse/csgraph/tests/test_shortest_path.py +@@ -1,3 +1,4 @@ ++import warnings + import numpy as np + from numpy.testing import assert_array_almost_equal, assert_array_equal + from pytest import raises as assert_raises +@@ -118,6 +119,7 @@ def test_undirected(): + for directed_in in (True, False): + check(method, directed_in) + ++ + def test_directed_sparse_zero(): + # test directed sparse graph with zero-weight edge and two connected components + def check(method): +@@ -128,6 +130,7 @@ def test_directed_sparse_zero(): + for method in methods: + check(method) + ++ + def test_undirected_sparse_zero(): + def check(method, directed_in): + if directed_in: +@@ -312,7 +315,7 @@ def test_buffer(method): + + + def test_NaN_warnings(): +- with pytest.warns(None) as record: ++ with warnings.catch_warnings(record=True) as record: + shortest_path(np.array([[0, 1], [np.nan, 0]])) + for r in record: + assert r.category is not RuntimeWarning +-- +2.33.0 + diff --git a/backport-MAINT-deprecated-np.typeDict.patch b/backport-MAINT-deprecated-np.typeDict.patch new file mode 100644 index 0000000000000000000000000000000000000000..13498263a7a012c2696e6c22ae9c1e955e1d76d3 --- /dev/null +++ b/backport-MAINT-deprecated-np.typeDict.patch @@ -0,0 +1,27 @@ +From f32946a7092207b47bc7f462de6326901b839d36 Mon Sep 17 00:00:00 2001 +From: Pamphile ROY +Date: Sun, 4 Apr 2021 11:04:27 +0200 +Subject: [PATCH] MAINT: deprecated np.typeDict + +Reference: https://github.com/scipy/scipy/commit/f32946a7092207b47bc7f462de6326901b839d36 +Conflict: NA +--- + scipy/ndimage/_ni_support.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scipy/ndimage/_ni_support.py b/scipy/ndimage/_ni_support.py +index 4b6912310..e8f39ed54 100644 +--- a/scipy/ndimage/_ni_support.py ++++ b/scipy/ndimage/_ni_support.py +@@ -86,7 +86,7 @@ def _get_output(output, input, shape=None, complex_output=False): + output = numpy.promote_types(output, numpy.complex64) + output = numpy.zeros(shape, dtype=output) + elif isinstance(output, str): +- output = numpy.typeDict[output] ++ output = numpy.sctypeDict[output] + if complex_output and numpy.dtype(output).kind != 'c': + raise RuntimeError("output must have complex dtype") + output = numpy.zeros(shape, dtype=output) +-- +2.36.1 + diff --git a/backport-TST-optimize-xfail-part-of-test_powell-14026.patch b/backport-TST-optimize-xfail-part-of-test_powell-14026.patch new file mode 100644 index 0000000000000000000000000000000000000000..62adb29734543c59e923c66d715c5acb4c6d2d1e --- /dev/null +++ b/backport-TST-optimize-xfail-part-of-test_powell-14026.patch @@ -0,0 +1,84 @@ +From 2ed34b807df741c200174e5bbfe558e77bc54f23 Mon Sep 17 00:00:00 2001 +From: Matt Haberland +Date: Fri, 14 May 2021 05:01:00 -0700 +Subject: [PATCH] TST: optimize: xfail part of test_powell (#14026) + +See gh-14014 + +Reference: https://github.com/mdhaber/scipy/commit/8a9168c304cf4abda77779071a4bbcb9b7280281 +Conflict: context differences +--- + scipy/optimize/tests/test_optimize.py | 35 ++++++++++++++++++++++++--- + 1 file changed, 32 insertions(+), 3 deletions(-) + +diff --git a/scipy/optimize/tests/test_optimize.py b/scipy/optimize/tests/test_optimize.py +index 1d733b3..1eb44f5 100644 +--- a/scipy/optimize/tests/test_optimize.py ++++ b/scipy/optimize/tests/test_optimize.py +@@ -210,6 +210,8 @@ class CheckOptimizeParameterized(CheckOptimize): + + assert_allclose(self.func(params), self.func(self.solution), + atol=1e-6) ++ # params[0] does not affect the objective function ++ assert_allclose(params[1:], self.solution[1:], atol=5e-6) + + # Ensure that function call counts are 'known good'; these are from + # SciPy 0.7.0. Don't allow them to increase. +@@ -223,6 +225,33 @@ class CheckOptimizeParameterized(CheckOptimize): + assert_(self.funccalls <= 116 + 20, self.funccalls) + assert_(self.gradcalls == 0, self.gradcalls) + ++ ++ @pytest.mark.xfail(reason="This part of test_powell fails on some " ++ "platforms, but the solution returned by powell is " ++ "still valid.") ++ def test_powell_gh14014(self): ++ # This part of test_powell started failing on some CI platforms; ++ # see gh-14014. Since the solution is still correct and the comments ++ # in test_powell suggest that small differences in the bits are known ++ # to change the "trace" of the solution, seems safe to xfail to get CI ++ # green now and investigate later. ++ ++ # Powell (direction set) optimization routine ++ if self.use_wrapper: ++ opts = {'maxiter': self.maxiter, 'disp': self.disp, ++ 'return_all': False} ++ res = optimize.minimize(self.func, self.startparams, args=(), ++ method='Powell', options=opts) ++ params, fopt, direc, numiter, func_calls, warnflag = ( ++ res['x'], res['fun'], res['direc'], res['nit'], ++ res['nfev'], res['status']) ++ else: ++ retval = optimize.fmin_powell(self.func, self.startparams, ++ args=(), maxiter=self.maxiter, ++ full_output=True, disp=self.disp, ++ retall=False) ++ (params, fopt, direc, numiter, func_calls, warnflag) = retval ++ + # Ensure that the function behaves the same; this is from SciPy 0.7.0 + assert_allclose(self.trace[34:39], + [[0.72949016, -0.44156936, 0.47100962], +@@ -240,7 +269,7 @@ class CheckOptimizeParameterized(CheckOptimize): + opts = {'maxiter': self.maxiter, 'disp': self.disp, + 'return_all': False} + res = optimize.minimize(self.func, self.startparams, args=(), +- bounds=bounds, ++ bounds=bounds, + method='Powell', options=opts) + params, fopt, direc, numiter, func_calls, warnflag = ( + res['x'], res['fun'], res['direc'], res['nit'], +@@ -1979,9 +2008,9 @@ class TestBrute: + assert_allclose(resbrute1[-1], resbrute[-1]) + assert_allclose(resbrute1[0], resbrute[0]) + +- ++ + def test_cobyla_threadsafe(): +- ++ + # Verify that cobyla is threadsafe. Will segfault if it is not. + + import concurrent.futures +-- +2.36.1 + diff --git a/backport-TST-pytest7.1.3-optimize-test-output-can-t-return-li.patch b/backport-TST-pytest7.1.3-optimize-test-output-can-t-return-li.patch new file mode 100644 index 0000000000000000000000000000000000000000..75c3099c4ef95003404d9b067ee07566dcf73845 --- /dev/null +++ b/backport-TST-pytest7.1.3-optimize-test-output-can-t-return-li.patch @@ -0,0 +1,49 @@ +From 6253992b63da1d2b422599d726aa72b57c21f69a Mon Sep 17 00:00:00 2001 +From: Andrew Nelson +Date: Wed, 26 Oct 2022 10:58:43 +1100 +Subject: [PATCH] TST: pytest7.1.3 optimize test output can't return list of + None + +Reference: https://github.com/scipy/scipy/commit/c8c2578c6dc814b7120f902e579c9bca4e87ebf3 +Conflict: context differences +--- + scipy/optimize/tests/test_minpack.py | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/scipy/optimize/tests/test_minpack.py b/scipy/optimize/tests/test_minpack.py +index 32c9109..49c348d 100644 +--- a/scipy/optimize/tests/test_minpack.py ++++ b/scipy/optimize/tests/test_minpack.py +@@ -202,10 +202,12 @@ class TestFSolve(object): + assert_array_almost_equal(final_flows, np.ones(4)) + + def test_concurrent_no_gradient(self): +- return sequence_parallel([self.test_pressure_network_no_gradient] * 10) ++ v = sequence_parallel([self.test_pressure_network_no_gradient] * 10) ++ assert np.all(np.array(v) == None) + + def test_concurrent_with_gradient(self): +- return sequence_parallel([self.test_pressure_network_with_gradient] * 10) ++ v = sequence_parallel([self.test_pressure_network_with_gradient] * 10) ++ assert np.all(np.array(v) == None) + + + class TestRootHybr(object): +@@ -385,10 +387,12 @@ class TestLeastSq(object): + assert_array_almost_equal(params_fit, self.abc, decimal=2) + + def test_concurrent_no_gradient(self): +- return sequence_parallel([self.test_basic] * 10) ++ v = sequence_parallel([self.test_basic] * 10) ++ assert np.all(np.array(v) == None) + + def test_concurrent_with_gradient(self): +- return sequence_parallel([self.test_basic_with_gradient] * 10) ++ v = sequence_parallel([self.test_basic_with_gradient] * 10) ++ assert np.all(np.array(v) == None) + + + class TestCurveFit(object): +-- +2.33.0 + diff --git a/backport-TST-pytest7.1.3-setup-setup_method.patch b/backport-TST-pytest7.1.3-setup-setup_method.patch new file mode 100644 index 0000000000000000000000000000000000000000..89eab5c3477fe4270c8f734fc1a8a2f1666f0afa --- /dev/null +++ b/backport-TST-pytest7.1.3-setup-setup_method.patch @@ -0,0 +1,27 @@ +From d9fe8d2285b0426085aaa77a0a23f777225da100 Mon Sep 17 00:00:00 2001 +From: Andrew Nelson +Date: Wed, 26 Oct 2022 10:37:25 +1100 +Subject: [PATCH] TST: pytest7.1.3 setup-->setup_method + +Reference: https://github.com/scipy/scipy/commit/d9fe8d2285b0426085aaa77a0a23f777225da100 +Conflict: NA +--- + scipy/_lib/tests/test_bunch.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scipy/_lib/tests/test_bunch.py b/scipy/_lib/tests/test_bunch.py +index 6525568b0..1af6f2d5f 100644 +--- a/scipy/_lib/tests/test_bunch.py ++++ b/scipy/_lib/tests/test_bunch.py +@@ -16,7 +16,7 @@ class TestMakeTupleBunch: + # Tests with Result + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +- def setup(self): ++ def setup_method(self): + # Set up an instance of Result. + self.result = Result(x=1, y=2, z=3, w=99, beta=0.5) + +-- +2.36.1 + diff --git a/scipy.spec b/scipy.spec index f2ef21fae372857093bcbe8f3b4a3f56f897eaa8..30f2b62cc907e23cf9cd95d81f9e744dde9524af 100644 --- a/scipy.spec +++ b/scipy.spec @@ -2,12 +2,19 @@ %global debug_package %{nil} Name: scipy Version: 1.6.2 -Release: 1 +Release: 2 Summary: A Python-based ecosystem of open-source software for mathematics, science, and engineering License: Qhull and Apache-2.0 URL: https://www.scipy.org Source0: https://github.com/scipy/scipy/releases/download/v%{version}/scipy-%{version}.tar.gz +Patch6000: backport-TST-pytest7.1.3-setup-setup_method.patch +Patch6001: backport-TST-pytest7.1.3-optimize-test-output-can-t-return-li.patch +Patch6002: backport-MAINT-deprecated-np.typeDict.patch +Patch6003: backport-BUG-The-pytest-decorator-for-conditional-skipping-is.patch +Patch6004: backport-MAINT-Replace-use-of-pytest.warns-None-with-warnings.patch +Patch6005: backport-TST-optimize-xfail-part-of-test_powell-14026.patch + BuildRequires: python3-devel python3-numpy >= 1.8.2 python3-numpy-f2py BuildRequires: gcc-c++ openblas-devel gcc-gfortran chrpath BuildRequires: pybind11-devel python3-pybind11 python3-Cython @@ -98,6 +105,9 @@ echo "%{_libdir}/%{name}" >> $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.c %config(noreplace) /etc/ld.so.conf.d/* %changelog +* Fri Jan 6 2023 Wenyu Liu - 1.6.2-2 +- bugfix for runtest + * Mon Dec 13 2021 zhouwenpei - 1.6.2-1 - upgrade to 1.6.2