Move test.test_support.catch_warning() to the warnings module, rename it

catch_warnings(), and clean up the API.

While expanding the test suite, a bug was found where a warning about the
'line' argument to showwarning() was not letting functions with '*args' go
without a warning.

Closes issue 3602.
Code review by Benjamin Peterson.
This commit is contained in:
Brett Cannon 2008-09-02 01:25:16 +00:00
parent 86533776c2
commit 1eaf0742d8
11 changed files with 208 additions and 126 deletions

View file

@ -73,11 +73,11 @@ __all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
import sys
import time
import socket # For gethostbyaddr()
from test.test_support import catch_warning
from warnings import filterwarnings
with catch_warning(record=False):
filterwarnings("ignore", ".*mimetools has been removed",
DeprecationWarning)
from warnings import filterwarnings, catch_warnings
with catch_warnings():
if sys.py3kwarning:
filterwarnings("ignore", ".*mimetools has been removed",
DeprecationWarning)
import mimetools
import SocketServer