diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2016-07-09 10:22:13 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-07-09 10:24:27 -0400 |
| commit | 4b6560f5a9a4f1788a1adcfbe43b8ceeeecfc0ef (patch) | |
| tree | 9486dc1daa48ec4abf22107c70321fde20608570 | |
| parent | a2af2420ce8f4f2bf67e095740e62fa2d3c249cf (diff) | |
[1.10.x] Fixed numpy deprecation warning silencing in template_tests.
Backport of 418658f453bed7fe7949dda26651aab370003e6a from master
| -rw-r--r-- | tests/template_tests/syntax_tests/test_numpy.py | 14 |
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): |
