Skip to content

Commit a144a7a

Browse files
committed
Move @skip_on_newlib to test.support
1 parent 7e743a3 commit a144a7a

3 files changed

Lines changed: 12 additions & 15 deletions

File tree

Lib/test/support/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2806,6 +2806,10 @@ def exceeds_recursion_limit():
28062806
is_s390x = hasattr(os, 'uname') and os.uname().machine == 's390x'
28072807
skip_on_s390x = unittest.skipIf(is_s390x, 'skipped on s390x')
28082808

2809+
# Cygwin uses the newlib C library
2810+
skip_on_newlib = unittest.skipIf(sys.platform == 'cygwin',
2811+
'the test fails on newlib C library')
2812+
28092813
Py_TRACE_REFS = hasattr(sys, 'getobjects')
28102814

28112815
_JIT_ENABLED = sys._jit.is_enabled()

Lib/test/test_math.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
math_testcases = os.path.join(test_dir, 'mathdata', 'math_testcases.txt')
3838
test_file = os.path.join(test_dir, 'mathdata', 'cmath_testcases.txt')
3939

40-
skip_on_newlib = unittest.skipIf(sys.platform == 'cygwin',
41-
'the test fails on newlib C library')
42-
4340

4441
def to_ulps(x):
4542
"""Convert a non-NaN float x to an integer, in such a way that
@@ -925,7 +922,7 @@ def testHypot(self):
925922
@requires_IEEE_754
926923
@unittest.skipIf(HAVE_DOUBLE_ROUNDING,
927924
"hypot() loses accuracy on machines with double rounding")
928-
@skip_on_newlib
925+
@support.skip_on_newlib
929926
def testHypotAccuracy(self):
930927
# Verify improved accuracy in cases that were known to be inaccurate.
931928
#
@@ -1248,7 +1245,7 @@ def testLog1p(self):
12481245
self.assertEqual(math.log1p(INF), INF)
12491246

12501247
@requires_IEEE_754
1251-
@skip_on_newlib
1248+
@support.skip_on_newlib
12521249
def testLog2(self):
12531250
self.assertRaises(TypeError, math.log2)
12541251

@@ -1281,7 +1278,7 @@ def testLog2(self):
12811278
@requires_IEEE_754
12821279
# log2() is not accurate enough on Mac OS X Tiger (10.4)
12831280
@support.requires_mac_ver(10, 5)
1284-
@skip_on_newlib
1281+
@support.skip_on_newlib
12851282
def testLog2Exact(self):
12861283
# Check that we get exact equality for log2 of powers of 2.
12871284
actual = [math.log2(math.ldexp(1.0, n)) for n in range(-1074, 1024)]
@@ -2621,7 +2618,7 @@ def test_fma_nan_results(self):
26212618
self.assertIsNaN(math.fma(a, math.nan, b))
26222619
self.assertIsNaN(math.fma(a, b, math.nan))
26232620

2624-
@skip_on_newlib
2621+
@support.skip_on_newlib
26252622
def test_fma_infinities(self):
26262623
# Cases involving infinite inputs or results.
26272624
positives = [1e-300, 2.3, 1e300, math.inf]
@@ -2750,7 +2747,7 @@ def test_fma_zero_result(self):
27502747
self.assertIsNegativeZero(math.fma(y-x, -(x+y), -z))
27512748
self.assertIsPositiveZero(math.fma(x-y, -(x+y), z))
27522749

2753-
@skip_on_newlib
2750+
@support.skip_on_newlib
27542751
def test_fma_overflow(self):
27552752
a = b = float.fromhex('0x1p512')
27562753
c = float.fromhex('0x1p1023')
@@ -2784,12 +2781,12 @@ def test_fma_overflow(self):
27842781
c = float.fromhex('0x1.fffffffffffffp+1023')
27852782
self.assertEqual(math.fma(a, b, -c), c)
27862783

2787-
@skip_on_newlib
2784+
@support.skip_on_newlib
27882785
def test_fma_single_round(self):
27892786
a = float.fromhex('0x1p-50')
27902787
self.assertEqual(math.fma(a - 1.0, a + 1.0, 1.0), a*a)
27912788

2792-
@skip_on_newlib
2789+
@support.skip_on_newlib
27932790
def test_random(self):
27942791
# A collection of randomly generated inputs for which the naive FMA
27952792
# (with two rounds) gives a different result from a singly-rounded FMA.

Lib/test/test_statistics.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import sys
1717
import unittest
1818
from test import support
19-
from test.support import import_helper, requires_IEEE_754
19+
from test.support import import_helper, requires_IEEE_754, skip_on_newlib
2020

2121
from decimal import Decimal
2222
from fractions import Fraction
@@ -138,10 +138,6 @@ def approx_equal(x, y, tol=1e-12, rel=1e-7):
138138
return actual_error <= allowed_error
139139

140140

141-
skip_on_newlib = unittest.skipIf(sys.platform == 'cygwin',
142-
'the test fails on newlib C library')
143-
144-
145141
# This class exists only as somewhere to stick a docstring containing
146142
# doctests. The following docstring and tests were originally in a separate
147143
# module. Now that it has been merged in here, I need somewhere to hang the.

0 commit comments

Comments
 (0)