test_warnings ironically had a single test that was not protecting the warnings

filter and was resetting it.
This commit is contained in:
Brett Cannon 2009-04-01 20:25:48 +00:00
parent 2da4d628a5
commit ce3d221447
2 changed files with 10 additions and 8 deletions

View File

@ -460,14 +460,14 @@ class _WarningsTests(BaseTest):
self.failUnless(text in result) self.failUnless(text in result)
def test_showwarning_not_callable(self): def test_showwarning_not_callable(self):
self.module.filterwarnings("always", category=UserWarning) with original_warnings.catch_warnings(module=self.module):
old_showwarning = self.module.showwarning self.module.filterwarnings("always", category=UserWarning)
self.module.showwarning = 23 old_showwarning = self.module.showwarning
try: self.module.showwarning = 23
self.assertRaises(TypeError, self.module.warn, "Warning!") try:
finally: self.assertRaises(TypeError, self.module.warn, "Warning!")
self.module.showwarning = old_showwarning finally:
self.module.resetwarnings() self.module.showwarning = old_showwarning
def test_show_warning_output(self): def test_show_warning_output(self):
# With showarning() missing, make sure that output is okay. # With showarning() missing, make sure that output is okay.

View File

@ -730,6 +730,8 @@ Extension Modules
Tests Tests
----- -----
- Fix test_warnings to no longer reset the warnings filter.
- Fix test_logging to no longer reset the warnings filter. - Fix test_logging to no longer reset the warnings filter.
- Issue #5635: Fix running test_sys with tracing enabled. - Issue #5635: Fix running test_sys with tracing enabled.