mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Silence DeprecationWarnings in test_urllib.
This commit is contained in:
parent
6f43a90901
commit
79b99dba0f
1 changed files with 13 additions and 8 deletions
|
@ -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/')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue