mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
This commit is contained in:
parent
ad59833649
commit
6257a7bbb2
21 changed files with 112 additions and 226 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue