diff options
| author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-31 22:01:03 (GMT) |
|---|---|---|
| committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-31 22:01:03 (GMT) |
| commit | 6257a7bbb2660ae75c44f2e71d7ac2ce73900f74 (patch) | |
| tree | 6f010065c95f2d5617f56e07ba2628be21cf9d7a /Lib/test/test_commands.py | |
| parent | ad5983364966b49c277b495112ae41c6ae2d01ed (diff) | |
| download | cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.zip cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.tar.gz cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.tar.bz2 | |
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
Diffstat (limited to 'Lib/test/test_commands.py')
| -rw-r--r-- | Lib/test/test_commands.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_commands.py b/Lib/test/test_commands.py index 4e482d2..2d10dea 100644 --- a/Lib/test/test_commands.py +++ b/Lib/test/test_commands.py @@ -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(): |
