summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2016-07-09 10:22:13 -0400
committerTim Graham <timograham@gmail.com>2016-07-09 10:24:31 -0400
commitb87d3180b20b785acc3b4099ad4df078474936d0 (patch)
treee3b35aa68b2f2c19348b668e97ffe9cab7dfb4ef
parentd5f1736dbd904096608cb35caf37decce9215915 (diff)
[1.9.x] Fixed numpy deprecation warning silencing in template_tests.
Backport of 418658f453bed7fe7949dda26651aab370003e6a from master
-rw-r--r--tests/template_tests/syntax_tests/test_numpy.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/template_tests/syntax_tests/test_numpy.py b/tests/template_tests/syntax_tests/test_numpy.py
index 822b10fd7a..16b4d74334 100644
--- a/tests/template_tests/syntax_tests/test_numpy.py
+++ b/tests/template_tests/syntax_tests/test_numpy.py
@@ -7,6 +7,7 @@ from ..utils import setup
try:
import numpy
+ VisibleDeprecationWarning = numpy.VisibleDeprecationWarning
except ImportError:
numpy = False
@@ -14,12 +15,13 @@ except ImportError:
@skipIf(numpy is False, "Numpy must be installed to run these tests.")
class NumpyTests(SimpleTestCase):
# Ignore numpy deprecation warnings (#23890)
- warnings.filterwarnings(
- "ignore",
- "Using a non-integer number instead of an "
- "integer will result in an error in the future",
- DeprecationWarning
- )
+ if numpy:
+ warnings.filterwarnings(
+ "ignore",
+ "Using a non-integer number instead of an "
+ "integer will result in an error in the future",
+ numpy.VisibleDeprecationWarning
+ )
@setup({'numpy-array-index01': '{{ var.1 }}'})
def test_numpy_array_index01(self):