diff --git a/0001-Replace-hash-function-for-test-of-weighted-astar.patch b/0001-Replace-hash-function-for-test-of-weighted-astar.patch new file mode 100644 index 0000000..f43e23c --- /dev/null +++ b/0001-Replace-hash-function-for-test-of-weighted-astar.patch @@ -0,0 +1,25 @@ +From 7e4ddaa2e1745cdb3ed9969680d755ce81ddcdfd Mon Sep 17 00:00:00 2001 +From: Ross Barnowski +Date: Mon, 5 Oct 2020 13:36:55 -0700 +Subject: [PATCH] TST: Modify heuristic for astar path test. + +Replace hash() with a sum-of-squares heuristic in +test_weight_functions so that the heuristic is not +platform-dependent. +--- + networkx/algorithms/shortest_paths/tests/test_weighted.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/networkx/algorithms/shortest_paths/tests/test_weighted.py b/networkx/algorithms/shortest_paths/tests/test_weighted.py +index b234618c4c..a4ba92c023 100644 +--- a/networkx/algorithms/shortest_paths/tests/test_weighted.py ++++ b/networkx/algorithms/shortest_paths/tests/test_weighted.py +@@ -198,7 +198,7 @@ def test_bidirectional_dijkstra(self): + + def test_weight_functions(self): + def heuristic(*z): +- return hash(z) ++ return sum(val ** 2 for val in z) + + def getpath(pred, v, s): + return [v] if v == s else getpath(pred, pred[v], s) + [v] diff --git a/disable-test-failing-in-i586.patch b/disable-test-failing-in-i586.patch deleted file mode 100644 index eec4a5d..0000000 --- a/disable-test-failing-in-i586.patch +++ /dev/null @@ -1,17 +0,0 @@ -From: Antonio Larrosa -Subject: Disable test that fails on i586 - -The issue was reported at https://github.com/networkx/networkx/issues/4203 -Index: networkx-2.5/networkx/algorithms/shortest_paths/tests/test_weighted.py -=================================================================== ---- networkx-2.5.orig/networkx/algorithms/shortest_paths/tests/test_weighted.py -+++ networkx-2.5/networkx/algorithms/shortest_paths/tests/test_weighted.py -@@ -230,7 +230,7 @@ class TestWeightedPath(WeightedTestBase) - vlp(G, s, t, length, nx.single_source_dijkstra, weight) - vlp(G, s, t, length, nx.single_source_bellman_ford, weight) - vlp(G, s, t, length, goldberg_radzik, weight) -- vlp(G, s, t, length, astar, weight) -+ #vlp(G, s, t, length, astar, weight) - - def weight(u, v, _): - return 2 ** (u * v) diff --git a/python-networkx.changes b/python-networkx.changes index 9f4caae..431f733 100644 --- a/python-networkx.changes +++ b/python-networkx.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Oct 6 11:47:47 UTC 2020 - Antonio Larrosa + +- Add patch from upstream that fixes gh#networkx/networkx#4203) + * 0001-Replace-hash-function-for-test-of-weighted-astar.patch +- Drop patch that is not needed anymore: + * disable-test-failing-in-i586.patch + ------------------------------------------------------------------- Fri Sep 11 06:08:25 UTC 2020 - Antonio Larrosa diff --git a/python-networkx.spec b/python-networkx.spec index 555acd2..78810ca 100644 --- a/python-networkx.spec +++ b/python-networkx.spec @@ -25,7 +25,7 @@ Summary: Python package for the study of complex networks License: BSD-3-Clause URL: https://networkx.github.io/ Source: https://files.pythonhosted.org/packages/source/n/networkx/networkx-%{version}.tar.gz -Patch0: disable-test-failing-in-i586.patch +Patch0: 0001-Replace-hash-function-for-test-of-weighted-astar.patch BuildRequires: %{python_module PyYAML} BuildRequires: %{python_module decorator >= 3.4.0} BuildRequires: %{python_module matplotlib >= 3.1}