summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-02-21 00:41:42 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-02-21 00:41:42 (GMT)
commit79b99dba0f538a14101eefc232d44f268f2e47be (patch)
treee0120359bc8aa4dba24ea675345ec976884e1c2f /Lib/test/test_urllib.py
parent6f43a90901dfa62ce8642b1e00da429b5347c768 (diff)
downloadcpython-79b99dba0f538a14101eefc232d44f268f2e47be.zip
cpython-79b99dba0f538a14101eefc232d44f268f2e47be.tar.gz
cpython-79b99dba0f538a14101eefc232d44f268f2e47be.tar.bz2
Silence DeprecationWarnings in test_urllib.
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r--Lib/test/test_urllib.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 52e7749..4f71b24 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -30,7 +30,10 @@ def urlopen(url, data=None, proxies=None):
if proxies is not None:
opener = urllib.request.FancyURLopener(proxies=proxies)
elif not _urlopener:
- opener = urllib.request.FancyURLopener()
+ with support.check_warnings(
+ ('FancyURLopener style of invoking requests is deprecated.',
+ DeprecationWarning)):
+ opener = urllib.request.FancyURLopener()
_urlopener = opener
else:
opener = _urlopener
@@ -1196,14 +1199,16 @@ class URLopener_Tests(unittest.TestCase):
class DummyURLopener(urllib.request.URLopener):
def open_spam(self, url):
return url
-
- self.assertEqual(DummyURLopener().open(
- 'spam://example/ /'),'//example/%20/')
-
- # test the safe characters are not quoted by urlopen
- self.assertEqual(DummyURLopener().open(
- "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"),
- "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/")
+ with support.check_warnings(
+ ('DummyURLopener style of invoking requests is deprecated.',
+ DeprecationWarning)):
+ self.assertEqual(DummyURLopener().open(
+ 'spam://example/ /'),'//example/%20/')
+
+ # test the safe characters are not quoted by urlopen
+ self.assertEqual(DummyURLopener().open(
+ "spam://c:|windows%/:=&?~#+!$,;'@()*[]|/path/"),
+ "//c:|windows%/:=&?~#+!$,;'@()*[]|/path/")
# Just commented them out.
# Can't really tell why keep failing in windows and sparc.