public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Benjamin A. Beasley <code@musicinmybrain.net>
To: git-commits@fedoraproject.org
Subject: [rpms/python-pint] rpmlint-etc: Backport fix for test_equal_zero_nan_NP rather than skipping it
Date: Sat, 12 Sep 2026 10:21:52 GMT	[thread overview]
Message-ID: <178920851250.1.8625634357716519491.rpms-python-pint-e1d6b874f0a8@fedoraproject.org> (raw)

            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

                 reply	other threads:[~2026-09-12 10:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178920851250.1.8625634357716519491.rpms-python-pint-e1d6b874f0a8@fedoraproject.org \
    --to=code@musicinmybrain.net \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox