Kaydet (Commit) 06615d0d authored tarafından Aymeric Augustin's avatar Aymeric Augustin

Avoided leaking warning filters.

üst 84c13749
...@@ -193,9 +193,8 @@ class DeprecatingRequestMergeDictTest(SimpleTestCase): ...@@ -193,9 +193,8 @@ class DeprecatingRequestMergeDictTest(SimpleTestCase):
@override_settings(USE_I18N=True) @override_settings(USE_I18N=True)
class DeprecatedChineseLanguageCodes(SimpleTestCase): class DeprecatedChineseLanguageCodes(SimpleTestCase):
def test_deprecation_warning(self): def test_deprecation_warning(self):
warnings.simplefilter('always')
with warnings.catch_warnings(record=True) as recorded: with warnings.catch_warnings(record=True) as recorded:
warnings.simplefilter('always')
with translation.override('zh-cn'): with translation.override('zh-cn'):
pass pass
with translation.override('zh-tw'): with translation.override('zh-tw'):
...@@ -214,9 +213,8 @@ class DeprecatingMemoizeTest(SimpleTestCase): ...@@ -214,9 +213,8 @@ class DeprecatingMemoizeTest(SimpleTestCase):
""" """
Ensure the correct warning is raised when memoize is used. Ensure the correct warning is raised when memoize is used.
""" """
warnings.simplefilter('always')
with warnings.catch_warnings(record=True) as recorded: with warnings.catch_warnings(record=True) as recorded:
warnings.simplefilter('always')
memoize(lambda x: x, {}, 1) memoize(lambda x: x, {}, 1)
msg = str(recorded.pop().message) msg = str(recorded.pop().message)
self.assertEqual(msg, self.assertEqual(msg,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment