8000 TST: parametrize glibc-version check in test_umath.py · lithomas1/numpy@22448b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 22448b4

Browse files
committed
TST: parametrize glibc-version check in test_umath.py
1 parent 12923c2 commit 22448b4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

numpy/core/tests/test_umath.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_glibc_version():
2828

2929

3030
glibcver = get_glibc_version()
31-
glibc_older_than_2_17 = (glibcver != '0.0' and glibcver < '2.17')
31+
glibc_older_than = lambda x: (glibcver != '0.0' and glibcver < x)
3232

3333
def on_powerpc():
3434
""" True if we are running on a Power PC platform."""
@@ -1012,10 +1012,9 @@ def test_exp_values(self):
10121012
yf = np.array(y, dtype=dt)
10131013
assert_equal(np.exp(yf), xf)
10141014

1015-
# Older version of glibc may not raise the correct FP exceptions
10161015
# See: https://github.com/numpy/numpy/issues/19192
10171016
@pytest.mark.xfail(
1018-
glibc_older_than_2_17,
1017+
glibc_older_than("2.17"),
10191018
reason="Older glibc versions may not raise appropriate FP exceptions"
10201019
)
10211020
def test_exp_exceptions(self):
@@ -1398,7 +1397,7 @@ def test_sincos_float32(self):
13981397
M = np.int_(N/20)
13991398
index = np.random.randint(low=0, high=N, size=M)
14001399
x_f32 = np.float32(np.random.uniform(low=-100.,high=100.,size=N))
1401-
if not glibc_older_than_2_17:
1400+
if not glibc_older_than("2.17"):
14021401
# test coverage for elements > 117435.992f for which glibc is used
14031402
# this is known to be problematic on old glibc, so skip it there
14041403
x_f32[index] = np.float32(10E+10*np.random.rand(M))
@@ -3434,7 +3433,7 @@ def check(x, rtol):
34343433
x_series = np.logspace(-20, -3.001, 200)
34353434
x_basic = np.logspace(-2.999, 0, 10, endpoint=False)
34363435

3437-
if glibc_older_than_2_17 and dtype is np.longcomplex:
3436+
if glibc_older_than("2.19") and dtype is np.longcomplex:
34383437
if (platform.machine() == 'aarch64' and bad_arcsinh()):
34393438
pytest.skip("Trig functions of np.longcomplex values known "
34403439
"to be inaccurate on aarch64 for some compilation "

0 commit comments

Comments
 (0)
0