diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-04-01 20:27:29 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-04-01 20:27:29 (GMT) |
commit | fcc052763ef2118ae1be8cd00342220587b4572a (patch) | |
tree | b5b518b7158b3ca9ab703a1445293fcde6d6cf87 /Lib/test/test_warnings.py | |
parent | b3af08f84c36106f8873d0fa7e8775aa0ef6ab75 (diff) | |
download | cpython-fcc052763ef2118ae1be8cd00342220587b4572a.zip cpython-fcc052763ef2118ae1be8cd00342220587b4572a.tar.gz cpython-fcc052763ef2118ae1be8cd00342220587b4572a.tar.bz2 |
Merged revisions 70979 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70979 | brett.cannon | 2009-04-01 13:25:48 -0700 (Wed, 01 Apr 2009) | 3 lines
test_warnings ironically had a single test that was not protecting the warnings
filter and was resetting it.
........
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r-- | Lib/test/test_warnings.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index 49f3d3a..d04c3dd 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -470,14 +470,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. |