17
0

Accepting request 1158180 from home:mcalabkova:branches:devel:languages:python:numeric

- Fix tests on Python 3.12 with tests-int-division.patch

OBS-URL: https://build.opensuse.org/request/show/1158180
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-python-louvain?expand=0&rev=20
This commit is contained in:
2024-03-15 14:20:54 +00:00
committed by Git OBS Bridge
parent 82dea3e89f
commit d2e5ef41d7
3 changed files with 26 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Mar 14 14:20:48 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Fix tests on Python 3.12 with tests-int-division.patch
-------------------------------------------------------------------
Fri Oct 14 09:09:53 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-python-louvain
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,7 +16,7 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?sle15_python_module_pythons}
%define skip_python2 1
%define skip_python36 1
Name: python-python-louvain
@@ -28,6 +28,8 @@ URL: https://github.com/taynaud/python-louvain
Source0: https://files.pythonhosted.org/packages/source/p/python-louvain/python-louvain-%{version}.tar.gz
# PATCH-FIX-UPSTREAM fix-test-karate.patch gh#taynaud/python-louvain#95
Patch: fix-test-karate.patch
# PATCH-FIX-UPSTREAM tests-int-division.patch gh#taynaud/python-louvain#104
Patch: tests-int-division.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module setuptools}
@@ -36,7 +38,8 @@ BuildRequires: python-rpm-macros
Requires: python-networkx
Requires: python-numpy
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
Provides: python-community = %{version}
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module networkx}
@@ -76,6 +79,7 @@ sed -i -e '/^#!\//, 1d' community/__init__.py
%doc README.rst
%license LICENSE
%python_alternative %{_bindir}/community
%{python_sitelib}/*
%{python_sitelib}/community
%{python_sitelib}/python_louvain-%{version}*-info
%changelog

13
tests-int-division.patch Normal file
View File

@@ -0,0 +1,13 @@
Index: python-louvain-0.16/test_community.py
===================================================================
--- python-louvain-0.16.orig/test_community.py
+++ python-louvain-0.16/test_community.py
@@ -61,7 +61,7 @@ class ModularityTest(unittest.TestCase):
graph = nx.erdos_renyi_graph(50, 0.1)
part = dict([])
for node in graph:
- part[node] = random.randint(0, self.number_of_tests / 10)
+ part[node] = random.randint(0, self.number_of_tests // 10)
mod = co.modularity(part, graph)
self.assertGreaterEqual(mod, -1)
self.assertLessEqual(mod, 1)