public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pint] rpmlint-etc: Use contextmanager for assertWarns
@ 2026-09-12 10:21 Matthias Runge
  0 siblings, 0 replies; only message in thread
From: Matthias Runge @ 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 : bc028d9d9a97fcba484ebe687b6f5b3cc2fe6fa9
            Author : Matthias Runge <mrunge@redhat.com>
            Date   : 2019-07-10T13:28:31+02:00
            Stats  : +68/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-pint/c/bc028d9d9a97fcba484ebe687b6f5b3cc2fe6fa9?branch=rpmlint-etc

            Log:
            Use contextmanager for assertWarns

Resolves: rhbz#1706212

---
diff --git a/955102b318a4ecc34afd0f366e826ef174fe647b.patch b/955102b318a4ecc34afd0f366e826ef174fe647b.patch
new file mode 100644
index 0000000..83fce2f
--- /dev/null
+++ b/955102b318a4ecc34afd0f366e826ef174fe647b.patch
@@ -0,0 +1,59 @@
+From 955102b318a4ecc34afd0f366e826ef174fe647b Mon Sep 17 00:00:00 2001
+From: xtreak <tir.karthi@gmail.com>
+Date: Sat, 29 Jun 2019 04:58:59 +0000
+Subject: [PATCH] Use context manager for assertWarns and fix
+ DeprecationWarning
+
+---
+ pint/testsuite/parameterized.py | 7 ++++++-
+ pint/testsuite/test_quantity.py | 5 +++--
+ 2 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/pint/testsuite/parameterized.py b/pint/testsuite/parameterized.py
+index 9b920373..7c459157 100644
+--- a/pint/testsuite/parameterized.py
++++ b/pint/testsuite/parameterized.py
+@@ -32,6 +32,11 @@
+ import collections
+ import unittest
+ 
++try:
++    from collections.abc import Callable
++except ImportError:
++    from collections import Callable
++
+ def add_metaclass(metaclass):
+     """Class decorator for creating a class with a metaclass."""
+     def wrapper(cls):
+@@ -69,7 +74,7 @@ def __new__(meta, classname, bases, class_dict):
+         new_class_dict = {}
+ 
+         for attr_name, attr_value in list(class_dict.items()):
+-            if isinstance(attr_value, collections.Callable) and hasattr(attr_value, 'param_names'):
++            if isinstance(attr_value, Callable) and hasattr(attr_value, 'param_names'):
+                 # print("Processing attr_name = %r; attr_value = %r" % (
+                 #     attr_name, attr_value))
+ 
+diff --git a/pint/testsuite/test_quantity.py b/pint/testsuite/test_quantity.py
+index fdb24600..232eea2c 100644
+--- a/pint/testsuite/test_quantity.py
++++ b/pint/testsuite/test_quantity.py
+@@ -383,7 +383,7 @@ def test_from_sequence(self):
+         self.assertFalse(u_array_2.u == u_array_ref_reversed.u)
+ 
+         u_array_3 = self.Q_.from_sequence(u_seq_reversed, units='g')
+-        self.assertTrue(all(u_array_3 == u_array_ref_reversed))        
++        self.assertTrue(all(u_array_3 == u_array_ref_reversed))
+         self.assertTrue(u_array_3.u == u_array_ref_reversed.u)
+ 
+         with self.assertRaises(ValueError):
+@@ -454,7 +454,8 @@ def test_limits_magnitudes(self):
+     def test_nonnumeric_magnitudes(self):
+         ureg = self.ureg
+         x = "some string"*ureg.m
+-        self.assertRaises(RuntimeError, self.compareQuantity_compact(x,x))
++        with self.assertWarns(RuntimeWarning):
++            self.compareQuantity_compact(x,x)
+ 
+ class TestQuantityBasicMath(QuantityTestCase):
+ 

diff --git a/python-pint.spec b/python-pint.spec
index 66d3388..14399f3 100644
--- a/python-pint.spec
+++ b/python-pint.spec
@@ -3,12 +3,16 @@
 
 Name:           python-pint
 Version:        0.9
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Physical quantities module
 
 License:        BSD
 URL:            https://github.com/hgrecco/pint
 Source0:        https://pypi.python.org/packages/source/P/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
+
+# Use context manager for assertWarns and fix DeprecationWarning
+Patch0: https://github.com/hgrecco/pint/commit/955102b318a4ecc34afd0f366e826ef174fe647b.patch
+
 BuildArch:      noarch
 
 %description
@@ -76,6 +80,10 @@ rm -rf html/.{doctrees,buildinfo}
 %license docs/_themes/LICENSE
 
 %changelog
+* Wed Jul 10 2019 Matthias Runge <mrunge@redhat.com> - 0.9-3
+- Use context manager for assertWarns and fix DeprecationWarning
+  resolves: rhbz#1706212
+
 * Sun Mar 17 2019 Miro Hrončok <mhroncok@redhat.com> - 0.9-2
 - Subpackages python2-pint, python2-pint-doc have been removed
   See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

^ 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: Use contextmanager for assertWarns Matthias Runge

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