summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-02-18 04:14:16 +0000
committerTim Peters <tim.peters@gmail.com>2006-02-18 04:14:16 +0000
commit6b17d6d31d217ab8f6ff21c28e38fa029308e75c (patch)
tree95199fd475cccfd727a0368d19e4325b58c912bd
parentad714194ec7afa3ed667649feb45770c544d120a (diff)
downloadcpython-6b17d6d31d217ab8f6ff21c28e38fa029308e75c.tar.gz
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.
-rw-r--r--Lib/test/test___all__.py4
-rwxr-xr-xLib/test/test_imageop.py6
-rw-r--r--Lib/test/test_sundry.py5
-rw-r--r--Lib/urllib2.py2
4 files changed, 16 insertions, 1 deletions
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 683867a871..7bf5314015 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -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):
diff --git a/Lib/test/test_imageop.py b/Lib/test/test_imageop.py
index 7b32bbc36c..b01e83fa28 100755
--- a/Lib/test/test_imageop.py
+++ b/Lib/test/test_imageop.py
@@ -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
diff --git a/Lib/test/test_sundry.py b/Lib/test/test_sundry.py
index 394d966db0..fd10b68197 100644
--- a/Lib/test/test_sundry.py
+++ b/Lib/test/test_sundry.py
@@ -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
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 19bf08205c..4c83bfc780 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -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')