Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(11)

Unified Diff: Lib/test/test_warnings.py

Issue 4180: warnings.simplefilter("always") does not make warnings always show up
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Python/_warnings.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Lib/test/test_warnings.py
===================================================================
--- Lib/test/test_warnings.py (revision 66997)
+++ Lib/test/test_warnings.py (working copy)
@@ -60,10 +60,12 @@
# The 'warnings' module must be explicitly set so that the proper
# interaction between _warnings and 'warnings' can be controlled.
sys.modules['warnings'] = self.module
+ self.save_warn_explicit = self.module.warn_explicit
super(BaseTest, self).setUp()
def tearDown(self):
sys.modules['warnings'] = original_warnings
+ self.module.warn_explicit = self.save_warn_explicit
super(BaseTest, self).tearDown()
@@ -424,6 +426,14 @@
result = stream.getvalue()
self.failUnless(text in result)
+ def test_replace_warn_explicit(self):
+ self.called = False
+ def my_warn_explicit(*args):
+ self.called = True
+ self.module.warn_explicit = my_warn_explicit
+ self.module.warn("foo")
+ self.assertTrue(self.called)
+
def test_showwarning_not_callable(self):
self.module.filterwarnings("always", category=UserWarning)
old_showwarning = self.module.showwarning
« no previous file with comments | « no previous file | Python/_warnings.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+