From 45d623c464d26c3a667b03047b1f626073d18e2c Mon Sep 17 00:00:00 2001 From: andrewgsavage Date: Wed, 15 May 2024 21:37:52 +0100 Subject: [PATCH] skip --- pint/testsuite/test_numpy.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pint/testsuite/test_numpy.py b/pint/testsuite/test_numpy.py index 38007be4a..a7710d890 100644 --- a/pint/testsuite/test_numpy.py +++ b/pint/testsuite/test_numpy.py @@ -13,6 +13,14 @@ from pint.testsuite.test_umath import TestUFuncs +def requires_numpy_2(reason=None): + if reason is None: + reason = "requires numpy >= 2" + return pytest.mark.skipif( + np.lib.NumpyVersion(np.__version__) < "2.0.0b1", reason=reason + ) + + @helpers.requires_numpy class TestNumpyMethods: @classmethod @@ -448,10 +456,7 @@ def test_trapz(self): @helpers.requires_array_function_protocol() # NP2: Remove this when we only support np>=2.0 - @pytest.mark.skipif( - np.lib.NumpyVersion(np.__version__) < "2.0.0b1", - reason="trapezoid added in numpy2", - ) + @requires_numpy_2(reason="trapezoid added in numpy2") def test_trapezoid(self): helpers.assert_quantity_equal( np.trapezoid([1.0, 2.0, 3.0, 4.0] * self.ureg.J, dx=1 * self.ureg.m),