Suppress new deprecation warnings when running the
authorTim Peters <tim.peters@gmail.com>
Sat, 18 Feb 2006 04:14:16 +0000 (04:14 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 18 Feb 2006 04:14:16 +0000 (04:14 +0000)
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.

Lib/test/test___all__.py
Lib/test/test_imageop.py
Lib/test/test_sundry.py
Lib/urllib2.py

index 683867a871ccc97f25d08109ef62dde51bfaaef3..7bf5314015852c8b60afbffcfa3e1bef879c3097 100644 (file)
@@ -9,6 +9,10 @@ warnings.filterwarnings("ignore", ".* 'pre' .*", DeprecationWarning,
                         r'pre$')
 warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning,
                         r'^regsub$')
+warnings.filterwarnings("ignore",
+                        "the gopherlib module is deprecated",
+                        DeprecationWarning,
+                        "<string>")
 
 class AllTest(unittest.TestCase):
 
index 7b32bbc36ce865e8f60631ecab4ca311fcd1d268..b01e83fa284d847833f9613f73600caf2c1c020f 100755 (executable)
@@ -9,6 +9,12 @@ from test.test_support import verbose, unlink
 
 import imageop, uu, os
 
+import warnings
+warnings.filterwarnings("ignore",
+                        "the rgbimg module is deprecated",
+                        DeprecationWarning,
+                        ".*test_imageop")
+
 def main(use_rgbimg=1):
 
     # Create binary test files
index 394d966db02a0c19f17679276c8fa2e4cfc9c68e..fd10b68197343c01a305e38b82f8e9d67825e2cf 100644 (file)
@@ -4,6 +4,11 @@ import warnings
 warnings.filterwarnings('ignore', r".*posixfile module",
                         DeprecationWarning, 'posixfile$')
 
+warnings.filterwarnings("ignore",
+                        "the gopherlib module is deprecated",
+                        DeprecationWarning,
+                        ".*test_sundry")
+
 from test.test_support import verbose
 
 import BaseHTTPServer
index 19bf08205c7577dc11278428f0f6d92bea1943ef..4c83bfc780fe56128ac4cb09ed5ffaced864b3ab 100644 (file)
@@ -89,7 +89,6 @@ f = urllib2.urlopen('http://www.python.org/')
 
 import base64
 import ftplib
-import gopherlib
 import httplib
 import inspect
 import md5
@@ -1259,6 +1258,7 @@ class CacheFTPHandler(FTPHandler):
 
 class GopherHandler(BaseHandler):
     def gopher_open(self, req):
+        import gopherlib  # this raises DeprecationWarning in 2.5
         host = req.get_host()
         if not host:
             raise GopherError('no host given')