Commit e2c9a6ce authored by Tim Peters's avatar Tim Peters

Suppress new deprecation warnings when running the

test suite.

For urllib2, move the import of gopherlib into the
only function that uses it:  users (including the
test suite) certainly shouldn't see a deprecation
warning just because they import urllib2!  If they
actually use gopher_open(), fine, _then_ they should
see a deprecation warning.
parent 24f7cad6
...@@ -9,6 +9,10 @@ warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning, ...@@ -9,6 +9,10 @@ warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning,
r'pre$') r'pre$')
warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning, warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning,
r'^regsub$') r'^regsub$')
warnings.filterwarnings("ignore",
"the gopherlib module is deprecated",
DeprecationWarning,
"<string>")
class AllTest(unittest.TestCase): class AllTest(unittest.TestCase):
......
...@@ -9,6 +9,12 @@ from test.test_support import verbose, unlink ...@@ -9,6 +9,12 @@ from test.test_support import verbose, unlink
import imageop, uu, os import imageop, uu, os
import warnings
warnings.filterwarnings("ignore",
"the rgbimg module is deprecated",
DeprecationWarning,
".*test_imageop")
def main(use_rgbimg=1): def main(use_rgbimg=1):
# Create binary test files # Create binary test files
......
...@@ -4,6 +4,11 @@ import warnings ...@@ -4,6 +4,11 @@ import warnings
warnings.filterwarnings('ignore', r".*posixfile module", warnings.filterwarnings('ignore', r".*posixfile module",
DeprecationWarning, 'posixfile$') DeprecationWarning, 'posixfile$')
warnings.filterwarnings("ignore",
"the gopherlib module is deprecated",
DeprecationWarning,
".*test_sundry")
from test.test_support import verbose from test.test_support import verbose
import BaseHTTPServer import BaseHTTPServer
......
...@@ -89,7 +89,6 @@ f = urllib2.urlopen('http://www.python.org/') ...@@ -89,7 +89,6 @@ f = urllib2.urlopen('http://www.python.org/')
import base64 import base64
import ftplib import ftplib
import gopherlib
import httplib import httplib
import inspect import inspect
import md5 import md5
...@@ -1259,6 +1258,7 @@ class CacheFTPHandler(FTPHandler): ...@@ -1259,6 +1258,7 @@ class CacheFTPHandler(FTPHandler):
class GopherHandler(BaseHandler): class GopherHandler(BaseHandler):
def gopher_open(self, req): def gopher_open(self, req):
import gopherlib # this raises DeprecationWarning in 2.5
host = req.get_host() host = req.get_host()
if not host: if not host:
raise GopherError('no host given') raise GopherError('no host given')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment