[Python-checkins] r42459 - in python/trunk/Lib: test/test___all__.py test/test_imageop.py test/test_sundry.py urllib2.py

tim.peters python-checkins at python.org
Sat Feb 18 05:14:17 CET 2006


Author: tim.peters
Date: Sat Feb 18 05:14:16 2006
New Revision: 42459

Modified:
   python/trunk/Lib/test/test___all__.py
   python/trunk/Lib/test/test_imageop.py
   python/trunk/Lib/test/test_sundry.py
   python/trunk/Lib/urllib2.py
Log:
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.


Modified: python/trunk/Lib/test/test___all__.py
==============================================================================
--- python/trunk/Lib/test/test___all__.py	(original)
+++ python/trunk/Lib/test/test___all__.py	Sat Feb 18 05:14:16 2006
@@ -9,6 +9,10 @@
                         r'pre$')
 warnings.filterwarnings("ignore", ".* regsub .*", DeprecationWarning,
                         r'^regsub$')
+warnings.filterwarnings("ignore",
+                        "the gopherlib module is deprecated",
+                        DeprecationWarning,
+                        "<string>")
 
 class AllTest(unittest.TestCase):
 

Modified: python/trunk/Lib/test/test_imageop.py
==============================================================================
--- python/trunk/Lib/test/test_imageop.py	(original)
+++ python/trunk/Lib/test/test_imageop.py	Sat Feb 18 05:14:16 2006
@@ -9,6 +9,12 @@
 
 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

Modified: python/trunk/Lib/test/test_sundry.py
==============================================================================
--- python/trunk/Lib/test/test_sundry.py	(original)
+++ python/trunk/Lib/test/test_sundry.py	Sat Feb 18 05:14:16 2006
@@ -4,6 +4,11 @@
 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

Modified: python/trunk/Lib/urllib2.py
==============================================================================
--- python/trunk/Lib/urllib2.py	(original)
+++ python/trunk/Lib/urllib2.py	Sat Feb 18 05:14:16 2006
@@ -89,7 +89,6 @@
 
 import base64
 import ftplib
-import gopherlib
 import httplib
 import inspect
 import md5
@@ -1259,6 +1258,7 @@
 
 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')


More information about the Python-checkins mailing list