test_warnings ironically had a single test that was not protecting the warnings
filter and was resetting it.
This commit is contained in:
parent
2da4d628a5
commit
ce3d221447
|
@ -460,14 +460,14 @@ class _WarningsTests(BaseTest):
|
|||
self.failUnless(text in result)
|
||||
|
||||
def test_showwarning_not_callable(self):
|
||||
self.module.filterwarnings("always", category=UserWarning)
|
||||
old_showwarning = self.module.showwarning
|
||||
self.module.showwarning = 23
|
||||
try:
|
||||
self.assertRaises(TypeError, self.module.warn, "Warning!")
|
||||
finally:
|
||||
self.module.showwarning = old_showwarning
|
||||
self.module.resetwarnings()
|
||||
with original_warnings.catch_warnings(module=self.module):
|
||||
self.module.filterwarnings("always", category=UserWarning)
|
||||
old_showwarning = self.module.showwarning
|
||||
self.module.showwarning = 23
|
||||
try:
|
||||
self.assertRaises(TypeError, self.module.warn, "Warning!")
|
||||
finally:
|
||||
self.module.showwarning = old_showwarning
|
||||
|
||||
def test_show_warning_output(self):
|
||||
# With showarning() missing, make sure that output is okay.
|
||||
|
|
Loading…
Reference in New Issue