Added test about error filterwarnings

Refs #20083.
This commit is contained in:
Claude Paroz 2014-03-08 11:51:08 +01:00
parent 0c6a339952
commit 8446a2438f
1 changed files with 10 additions and 0 deletions

View File

@ -128,6 +128,16 @@ class WarningLoggerTests(TestCase):
output = force_text(self.outputs[0].getvalue()) output = force_text(self.outputs[0].getvalue())
self.assertFalse('Foo Deprecated' in output) 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): class CallbackFilterTest(TestCase):
def test_sense(self): def test_sense(self):