diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-09-02 09:11:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-02 09:11:59 -0500 |
commit | 9164f23c19c049e28d4d4825a53bbb01aedabcfc (patch) | |
tree | f017b7eb7565690a755263df12c835d61e89a8a4 /numpy/testing/tests/test_utils.py | |
parent | 8eedd3e911b7e3f5f35961871ddb8ee1559d4225 (diff) | |
parent | 514d13679a55a82a96689679002c4ddc514641ce (diff) | |
download | numpy-9164f23c19c049e28d4d4825a53bbb01aedabcfc.tar.gz |
Merge pull request #7099 from seberg/suppressed_warnings
Suppressed warnings
Diffstat (limited to 'numpy/testing/tests/test_utils.py')
-rw-r--r-- | numpy/testing/tests/test_utils.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index c0f609883..c191aea5b 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -503,23 +503,21 @@ class TestWarns(unittest.TestCase): warnings.warn("yo", DeprecationWarning) failed = False - filters = sys.modules['warnings'].filters[:] - try: + with warnings.catch_warnings(): + warnings.simplefilter("error", DeprecationWarning) try: - # Should raise an AssertionError + # Should raise a DeprecationWarning assert_warns(UserWarning, f) failed = True - except AssertionError: + except DeprecationWarning: pass - finally: - sys.modules['warnings'].filters = filters if failed: raise AssertionError("wrong warning caught by assert_warn") class TestAssertAllclose(unittest.TestCase): - + def test_simple(self): x = 1e-3 y = 1e-9 |