Subject: [bug#58012] [core-updates PATCH 7/7] gnu: python-louvain: Fix test.

From: Greg Hogan <[email-masked]>
Date: Thu, 22 Sep 2022 19:44:10 +0000

* gnu/packages/graph.scm (python-louvain)[source]: Add patch.
* gnu/packages/patches/python-louvain-fix-test.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patch.
---
 gnu/local.mk                                      |  1 +
 gnu/packages/graph.scm                            |  1 +
 .../patches/python-louvain-fix-test.patch         | 15 +++++++++++++++
 3 files changed, 17 insertions(+)
 create mode 100644 gnu/packages/patches/python-louvain-fix-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ef1bae5f3c..11213b2197 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1614,6 +1614,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ppsspp-disable-upgrade-and-gold.patch		\
   %D%/packages/patches/pthreadpool-system-libraries.patch	\
   %D%/packages/patches/python-chai-drop-python2.patch		\
+  %D%/packages/patches/python-louvain-fix-test.patch		\
   %D%/packages/patches/python-random2-getrandbits-test.patch		\
   %D%/packages/patches/python-poppler-qt5-fix-build.patch	\
   %D%/packages/patches/python-w3lib-fix-test-failure.patch	\
diff --git a/gnu/packages/graph.scm b/gnu/packages/graph.scm
index 109ba68675..02c80f0682 100644
--- a/gnu/packages/graph.scm
+++ b/gnu/packages/graph.scm
@@ -290,6 +290,7 @@ (define-public python-louvain
      (origin
        (method url-fetch)
        (uri (pypi-uri "python-louvain" version))
+       (patches (search-patches "python-louvain-fix-test.patch"))
        (sha256
         (base32 "0sx53l555rwq0z7if8agirjgw4ddp8r9b949wwz8vlig03sjvfmp"))))
     (build-system python-build-system)
diff --git a/gnu/packages/patches/python-louvain-fix-test.patch b/gnu/packages/patches/python-louvain-fix-test.patch
new file mode 100644
index 0000000000..2127df681c
--- /dev/null
+++ b/gnu/packages/patches/python-louvain-fix-test.patch
@@ -0,0 +1,15 @@
+https://github.com/taynaud/python-louvain/commit/638804ae636dc65306900ef6518ca0a1c9202566.diff
+
+diff --git a/test_community.py b/test_community.py
+index 1ee1976..566a4b1 100644
+--- a/test_community.py
++++ b/test_community.py
+@@ -203,7 +203,7 @@ def test_karate(self):
+         self.assertAlmostEqual(co.modularity(part, graph),
+                                co.modularity(part_weight,
+                                              graph,
+-                                             "test_weight"), places=2)
++                                             "test_weight"), places=1)
+ 
+         part_res_low = co.best_partition(graph, resolution=0.1)
+         self.assertTrue(
-- 
2.37.3