summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-06-12 13:15:46 -0600
committerGitHub <noreply@github.com>2021-06-12 13:15:46 -0600
commitb5cc1f80c6747e6c19adeaf241d2d471d2b71cb7 (patch)
treef769018c52fd523a995aba1cb3278d1c015d8dd7 /numpy
parentd3ff4e02375ee29b4b8f585959f0b87e574edb92 (diff)
parent167a2c7cd95b821e3fcc464c4bc6582bf8b87443 (diff)
downloadnumpy-b5cc1f80c6747e6c19adeaf241d2d471d2b71cb7.tar.gz
Merge pull request #19209 from r-devulap/glibc-ver-2.17
TST: Ignore exp FP exceptions test for glibc ver < 2.17
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_umath.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 9d1b13b53..2378b11e9 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -4,6 +4,7 @@ import fnmatch
import itertools
import pytest
import sys
+import os
from fractions import Fraction
from functools import reduce
@@ -17,6 +18,20 @@ from numpy.testing import (
_gen_alignment_data, assert_array_almost_equal_nulp, assert_warns
)
+def get_glibc_version():
+ try:
+ ver = os.confstr('CS_GNU_LIBC_VERSION').rsplit(' ')[1]
+ except Exception as inst:
+ ver = '0.0'
+
+ return ver
+
+
+glibcver = get_glibc_version()
+glibc_newerthan_2_17 = pytest.mark.xfail(
+ glibcver != '0.0' and glibcver < '2.17',
+ reason="Older glibc versions may not raise appropriate FP exceptions")
+
def on_powerpc():
""" True if we are running on a Power PC platform."""
return platform.processor() == 'powerpc' or \
@@ -986,6 +1001,10 @@ class TestSpecialFloats:
yf = np.array(y, dtype=dt)
assert_equal(np.exp(yf), xf)
+ # Older version of glibc may not raise the correct FP exceptions
+ # See: https://github.com/numpy/numpy/issues/19192
+ @glibc_newerthan_2_17
+ def test_exp_exceptions(self):
with np.errstate(over='raise'):
assert_raises(FloatingPointError, np.exp, np.float32(100.))
assert_raises(FloatingPointError, np.exp, np.float32(1E19))