Silence DeprecationWarnings in test_urllib.

This commit is contained in:
Ezio Melotti 2013-02-21 02:41:42 +02:00
parent 6f43a90901
commit 79b99dba0f

View file

@ -30,6 +30,9 @@ def urlopen(url, data=None, proxies=None):
if proxies is not None:
opener = urllib.request.FancyURLopener(proxies=proxies)
elif not _urlopener:
with support.check_warnings(
('FancyURLopener style of invoking requests is deprecated.',
DeprecationWarning)):
opener = urllib.request.FancyURLopener()
_urlopener = opener
else:
@ -1196,7 +1199,9 @@ class URLopener_Tests(unittest.TestCase):
class DummyURLopener(urllib.request.URLopener):
def open_spam(self, url):
return url
with support.check_warnings(
('DummyURLopener style of invoking requests is deprecated.',
DeprecationWarning)):
self.assertEqual(DummyURLopener().open(
'spam://example/ /'),'//example/%20/')