[Python-checkins] cpython (merge 3.3 -> default): Merge DeprecationWarnings silencing in test_urllib from 3.3.

ezio.melotti python-checkins at python.org
Thu Feb 21 01:56:12 CET 2013


http://hg.python.org/cpython/rev/3a110a506d35
changeset:   82291:3a110a506d35
parent:      82287:e2aa7ffa2005
parent:      82290:1bcddc0a3765
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Thu Feb 21 02:55:56 2013 +0200
summary:
  Merge DeprecationWarnings silencing in test_urllib from 3.3.

files:
  Lib/test/test_urllib.py |  21 +++++++++++++--------
  1 files changed, 13 insertions(+), 8 deletions(-)


diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -30,7 +30,10 @@
     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
@@ -1271,14 +1274,16 @@
         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/')
 
-        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/")
+            # 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.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list