From 8446a2438ffeab845e31cba4489f03fccc387298 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 8 Mar 2014 11:51:08 +0100 Subject: [PATCH] Added test about error filterwarnings Refs #20083. --- tests/logging_tests/tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py index 8aff4ec6c4..34ed24dc6a 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -128,6 +128,16 @@ class WarningLoggerTests(TestCase): output = force_text(self.outputs[0].getvalue()) self.assertFalse('Foo Deprecated' in output) + @override_settings(DEBUG=True) + def test_error_filter_still_raises(self): + with warnings.catch_warnings(): + warnings.filterwarnings( + 'error', + category=RemovedInNextVersionWarning + ) + with self.assertRaises(RemovedInNextVersionWarning): + warnings.warn('Foo Deprecated', RemovedInNextVersionWarning) + class CallbackFilterTest(TestCase): def test_sense(self):