public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pint] rpmlint-etc: Backport fix for test_equal_zero_nan_NP rather than skipping it
@ 2026-09-12 10:21 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-09-12 10:21 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-pint
            Branch : rpmlint-etc
            Commit : e1d6b874f0a8329cc6aa0354189f213eb0ed8c8f
            Author : Benjamin A. Beasley <code@musicinmybrain.net>
            Date   : 2023-10-30T10:20:55-04:00
            Stats  : +37/-10 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-pint/c/e1d6b874f0a8329cc6aa0354189f213eb0ed8c8f?branch=rpmlint-etc

            Log:
            Backport fix for test_equal_zero_nan_NP rather than skipping it

The backported commit simply removes the failing assertion.

---
diff --git a/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f.patch b/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f.patch
new file mode 100644
index 0000000..c1ff95d
--- /dev/null
+++ b/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f.patch
@@ -0,0 +1,26 @@
+From b3b18277ecc682bff7ca1fa9e48992f7ec68e47f Mon Sep 17 00:00:00 2001
+From: Hernan Grecco <hgrecco@gmail.com>
+Date: Wed, 12 Jul 2023 20:39:13 -0300
+Subject: [PATCH] Fix test as NumPy 1.25 changes the rules for equality
+ operator
+
+---
+ pint/testsuite/test_quantity.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/pint/testsuite/test_quantity.py b/pint/testsuite/test_quantity.py
+index 1843b69ca..7efe74f80 100644
+--- a/pint/testsuite/test_quantity.py
++++ b/pint/testsuite/test_quantity.py
+@@ -1906,7 +1906,10 @@ def test_equal_zero_nan_NP(self):
+             self.Q_([0, 1, 2], "J") == np.array([0, 0, np.nan]),
+             np.asarray([True, False, False]),
+         )
+-        assert not (self.Q_(np.arange(4), "J") == np.zeros(3))
++
++        # This raise an exception on NumPy 1.25 as dimensions
++        # are different
++        # assert not (self.Q_(np.arange(4), "J") == np.zeros(3))
+ 
+     def test_offset_equal_zero(self):
+         ureg = self.ureg

diff --git a/python-pint.spec b/python-pint.spec
index 4e795cb..a9fc7ec 100644
--- a/python-pint.spec
+++ b/python-pint.spec
@@ -11,6 +11,15 @@ License:        BSD-3-Clause
 URL:            https://github.com/hgrecco/pint
 Source0:        %{pypi_source Pint}
 
+# Fix test as NumPy 1.25 changes the rules for equality operator
+# https://github.com/hgrecco/pint/commit/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f
+#
+# Fixes:
+#
+# test_equal_zero_nan_NP fails with numpy 1.25.1
+# https://github.com/hgrecco/pint/issues/1825
+Patch:          %{url}/commit/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f.patch
+
 BuildArch:      noarch
 
 %global _description %{expand:
@@ -33,7 +42,7 @@ Summary:        %{summary}
 %pyproject_extras_subpkg -n python3-pint numpy
 
 %prep
-%autosetup -n Pint-%{version}
+%autosetup -n Pint-%{version} -p1
 
 # We are not sure where this was bundled from, but we are pretty sure it was
 # bundled from somewhere! We are not building HTML documentation, so we do not
@@ -75,15 +84,7 @@ find pint -type f -exec \
 %pyproject_save_files pint
 
 %check
-%global numpy_version %(\
-    %{python3} -c 'import numpy; print(numpy.__version__)' || echo 0)
-# test_equal_zero_nan_NP fails with numpy 1.25.1
-# https://github.com/hgrecco/pint/issues/1825
-%if v"%{numpy_version}" >= v"1.25.1"
-k="${k-}${k+ and }not (TestCompareNeutral and test_equal_zero_nan_NP)"
-%endif
-
-%pytest -k "${k-}"
+%pytest
 
 %files -n python3-pint -f %{pyproject_files}
 %{_bindir}/pint-convert

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-12 10:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-12 10:21 [rpms/python-pint] rpmlint-etc: Backport fix for test_equal_zero_nan_NP rather than skipping it Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox