From cc873c6c7cea65f19a17f8c6a4dbe4791db3a5d646b612adbeaf62434230a237 Mon Sep 17 00:00:00 2001 From: Ana Guerrero Date: Wed, 18 Feb 2026 16:04:45 +0000 Subject: [PATCH 1/2] Accepting request 1333726 from devel:languages:python:numeric - TST: Use correct method of clearing mock objects - Upstream patch correct-reset-mock.patch, gh#matplotlib/matplotlib#31153 OBS-URL: https://build.opensuse.org/request/show/1333726 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-matplotlib?expand=0&rev=126 (cherry picked from commit b63589ad003330d4ffd601331db0840c68d19b7c7e017b503c81273d4a884606) --- correct-reset-mock.patch | 41 +++++++++++++++++++++++++++++++++++++++ python-matplotlib.changes | 6 ++++++ python-matplotlib.spec | 2 ++ 3 files changed, 49 insertions(+) create mode 100644 correct-reset-mock.patch diff --git a/correct-reset-mock.patch b/correct-reset-mock.patch new file mode 100644 index 0000000..b40aa89 --- /dev/null +++ b/correct-reset-mock.patch @@ -0,0 +1,41 @@ +From 63207bbc8c5f791d1ca5565db39a8e2400165e7b Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Fri, 13 Feb 2026 23:21:46 +0530 +Subject: [PATCH] TST: Use correct method of clearing mock objects + +In Python 3.13.12 and 3.14.3, fixes for thread-safety of mock +`call_count` meant that manually changing it no longer works [1]. +Instead use the more correct `reset_mock` method. + +[1] https://github.com/python/cpython/issues/142651#issuecomment-3872242970 +--- + lib/matplotlib/tests/test_backends_interactive.py | 2 +- + lib/matplotlib/tests/test_colors.py | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/matplotlib/tests/test_backends_interactive.py b/lib/matplotlib/tests/test_backends_interactive.py +index 101c1cb81cad..188983816372 100644 +--- a/lib/matplotlib/tests/test_backends_interactive.py ++++ b/lib/matplotlib/tests/test_backends_interactive.py +@@ -669,7 +669,7 @@ def _impl_test_interactive_timers(): + assert mock.call_count > 1 + + # Now turn it into a single shot timer and verify only one gets triggered +- mock.call_count = 0 ++ mock.reset_mock() + timer.single_shot = True + timer.start() + plt.pause(pause_time) +diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py +index 1c4cebf037e4..0aef16428f9f 100644 +--- a/lib/matplotlib/tests/test_colors.py ++++ b/lib/matplotlib/tests/test_colors.py +@@ -1646,7 +1646,7 @@ def test_norm_callback(): + assert increment.call_count == 2 + + # We only want autoscale() calls to send out one update signal +- increment.call_count = 0 ++ increment.reset_mock() + norm.autoscale([0, 1, 2]) + assert increment.call_count == 1 + diff --git a/python-matplotlib.changes b/python-matplotlib.changes index d99ec4e..59d5b8d 100644 --- a/python-matplotlib.changes +++ b/python-matplotlib.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Feb 18 10:11:22 UTC 2026 - Daniel Garcia + +- TST: Use correct method of clearing mock objects +- Upstream patch correct-reset-mock.patch, gh#matplotlib/matplotlib#31153 + ------------------------------------------------------------------- Thu Jul 3 07:36:25 UTC 2025 - Nico Krapp diff --git a/python-matplotlib.spec b/python-matplotlib.spec index c94ff10..8e3498c 100644 --- a/python-matplotlib.spec +++ b/python-matplotlib.spec @@ -61,6 +61,8 @@ Source100: python-matplotlib.rpmlintrc Patch1: matplotlib-meson-options-opensuse.patch # PATCH-FIX-UPSTREAM Pillow-13-compat.patch https://github.com/matplotlib/matplotlib/pull/30221 Patch2: Pillow-13-compat.patch +# PATCH-FIX-UPSTREAM correct-reset-mock.patch gh#matplotlib/matplotlib#31153 +Patch3: correct-reset-mock.patch Recommends: ghostscript Recommends: libxml2-tools Recommends: poppler-tools -- 2.51.1 From 5feca0adc7d5e61f1c7d727e4545cbbb3558630dee80225af2d5a0281be7b1bc Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Sun, 1 Mar 2026 21:13:45 +0000 Subject: [PATCH 2/2] Adapt %suse_version check, jsc#PED-15807 OBS-URL: https://build.opensuse.org/request/show/1335268 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-matplotlib?expand=0&rev=127 (cherry picked from commit 0812b0b0f602d281b6ca6f76977089ee5a60b22353f2651e9120a76c022f435c) --- python-matplotlib.changes | 6 ++++++ python-matplotlib.spec | 12 +++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/python-matplotlib.changes b/python-matplotlib.changes index 59d5b8d..98e860d 100644 --- a/python-matplotlib.changes +++ b/python-matplotlib.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Feb 26 11:39:37 UTC 2026 - Daniel Garcia + +- Adapt %suse_version checks to support new %suse_version design for + 16.1 and following (1610, 1620, 1630...) + ------------------------------------------------------------------- Wed Feb 18 10:11:22 UTC 2026 - Daniel Garcia diff --git a/python-matplotlib.spec b/python-matplotlib.spec index 8e3498c..1973263 100644 --- a/python-matplotlib.spec +++ b/python-matplotlib.spec @@ -16,8 +16,6 @@ # -%define SLE_VERSION 1600 - %global flavor @BUILD_FLAVOR@%{nil} %if "%{flavor}" == "test" %define psuffix -test @@ -38,7 +36,7 @@ ExclusiveArch: x86_64 aarch64 %endif # Disable wxWidgets backend in Factory Ring 1 (Minimal-X) and SLE <= 16 -%if %{with ringdisabled} || 0%{?suse_version} <= %SLE_VERSION +%if %{with ringdisabled} || 0%{?suse_version} < 1699 %bcond_with wx %else %bcond_without wx @@ -126,7 +124,7 @@ BuildRequires: %{python_module cairo >= 1.14.0} BuildRequires: %{python_module cairocffi >= 0.8} # /SECTION cairo # SECTION nbagg backend tests: not in Minimal-X or SLE <= 16 -%if %{without ringdisabled} && 0%{?suse_version} > %SLE_VERSION +%if %{without ringdisabled} && 0%{?suse_version} >= 1699 BuildRequires: %{python_module matplotlib-nbagg = %{version}} BuildRequires: %{python_module nbconvert if %python-base >= 3.10} BuildRequires: %{python_module nbformat if %python-base >= 3.10} @@ -136,7 +134,7 @@ BuildRequires: %{python_module nbformat if %python-base >= 3.10} %if %{with qt} BuildRequires: %{python_module PyQt6} BuildRequires: %{python_module matplotlib-qt = %{version}} -%if %{without ringdisabled} && 0%{?suse_version} > %SLE_VERSION +%if %{without ringdisabled} && 0%{?suse_version} >= 1699 # Don'test Pyside6 in Minimal-X or Leap <=16 BuildRequires: python3-pyside6 %endif @@ -362,7 +360,7 @@ skip_tests+=" or png or svg or pdf" skip_tests+=" or (test_backend_pgf and test_rcupdate)" # Fails in SLFO:Main -%if 0%{?suse_version} <= %SLE_VERSION +%if 0%{?suse_version} < 1699 # Timeout, this test freeze forever skip_tests+=" or test_determinism" skip_tests+=" or test_pcolormesh[png] or test_pcolormesh_alpha[png]" @@ -497,7 +495,7 @@ $python -m pytest --pyargs matplotlib.tests \ %{python_sitearch}/matplotlib/backends/_backend_gtk.py %pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/_backend_gtk.*.py* -%if 0%{?suse_version} > %SLE_VERSION +%if 0%{?suse_version} >= 1699 %files %{python_files nbagg} %license LICENSE/ %{python_sitearch}/matplotlib/backends/backend_nbagg.py* -- 2.51.1