diff options
author | Christian Kastner <ckk@kvr.at> | 2020-02-26 23:02:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 17:02:41 -0500 |
commit | acba24414487e0e171bedbc8d1ae3cfc63f4b2c7 (patch) | |
tree | f9abf0822229454dde8f767e2dc9998272810101 /numpy/core/tests | |
parent | 40fad321343dd8a28129c668c8037a35e9b33989 (diff) | |
download | numpy-acba24414487e0e171bedbc8d1ae3cfc63f4b2c7.tar.gz |
TST: Test division by zero both with scalar and with array (gh-15577)
The value for platform.machine() was reported from Debian in 2012, but current
Debian systems no longer this value. Switch the test to the new arm_softfloat
flag, which is the actual underlying cause of the test failure.
closes gh-15562
Diffstat (limited to 'numpy/core/tests')
-rw-r--r-- | numpy/core/tests/test_errstate.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/numpy/core/tests/test_errstate.py b/numpy/core/tests/test_errstate.py index 7c1780607..184a37300 100644 --- a/numpy/core/tests/test_errstate.py +++ b/numpy/core/tests/test_errstate.py @@ -1,12 +1,19 @@ -import platform import pytest +import sysconfig import numpy as np from numpy.testing import assert_, assert_raises +# The floating point emulation on ARM EABI systems lacking a hardware FPU is +# known to be buggy. This is an attempt to identify these hosts. It may not +# catch all possible cases, but it catches the known cases of gh-413 and +# gh-15562. +hosttype = sysconfig.get_config_var('HOST_GNU_TYPE') +arm_softfloat = False if hosttype is None else hosttype.endswith('gnueabi') class TestErrstate: - @pytest.mark.skipif(platform.machine() == "armv5tel", reason="See gh-413.") + @pytest.mark.skipif(arm_softfloat, + reason='platform/cpu issue with FPU (gh-413,-15562)') def test_invalid(self): with np.errstate(all='raise', under='ignore'): a = -np.arange(3) @@ -17,6 +24,8 @@ class TestErrstate: with assert_raises(FloatingPointError): np.sqrt(a) + @pytest.mark.skipif(arm_softfloat, + reason='platform/cpu issue with FPU (gh-15562)') def test_divide(self): with np.errstate(all='raise', under='ignore'): a = -np.arange(3) @@ -26,6 +35,9 @@ class TestErrstate: # While this should fail! with assert_raises(FloatingPointError): a // 0 + # As should this, see gh-15562 + with assert_raises(FloatingPointError): + a // a def test_errcall(self): def foo(*args): |