Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.

This commit is contained in:
Florent Xicluna 2010-03-31 22:01:03 +00:00
parent ad59833649
commit 6257a7bbb2
21 changed files with 112 additions and 226 deletions

View file

@ -4,12 +4,9 @@
'''
import unittest
import os, tempfile, re
import warnings
warnings.filterwarnings('ignore', r".*commands.getstatus.. is deprecated",
DeprecationWarning)
from test.test_support import run_unittest, reap_children, import_module
from test.test_support import run_unittest, reap_children, import_module, \
check_warnings
# Silence Py3k warning
commands = import_module('commands', deprecated=True)
@ -59,7 +56,9 @@ class CommandTests(unittest.TestCase):
/\. # and end with the name of the file.
'''
self.assertTrue(re.match(pat, commands.getstatus("/."), re.VERBOSE))
with check_warnings((".*commands.getstatus.. is deprecated",
DeprecationWarning)):
self.assertTrue(re.match(pat, commands.getstatus("/."), re.VERBOSE))
def test_main():