[Python-checkins] cpython: Undo an accidental commit.

brett.cannon python-checkins at python.org
Tue Mar 15 23:48:59 CET 2011


http://hg.python.org/cpython/rev/0a3b00d2c31c
changeset:   68574:0a3b00d2c31c
user:        Brett Cannon <brett at python.org>
date:        Tue Mar 15 18:48:52 2011 -0400
summary:
  Undo an accidental commit.

files:
  Lib/test/test_urllibnet.py

diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -46,7 +46,7 @@
         with support.transient_internet(resource):
             return urllib.request.urlopen(*args, **kwargs)
 
-    def _test_basic(self):
+    def test_basic(self):
         # Simple test expected to pass.
         open_url = self.urlopen("http://www.python.org/")
         for attr in ("read", "readline", "readlines", "fileno", "close",
@@ -58,7 +58,7 @@
         finally:
             open_url.close()
 
-    def _test_readlines(self):
+    def test_readlines(self):
         # Test both readline and readlines.
         open_url = self.urlopen("http://www.python.org/")
         try:
@@ -69,7 +69,7 @@
         finally:
             open_url.close()
 
-    def _test_info(self):
+    def test_info(self):
         # Test 'info'.
         open_url = self.urlopen("http://www.python.org/")
         try:
@@ -81,7 +81,7 @@
                                   "instance of email.message.Message")
             self.assertEqual(info_obj.get_content_subtype(), "html")
 
-    def _test_geturl(self):
+    def test_geturl(self):
         # Make sure same URL as opened is returned by geturl.
         URL = "http://www.python.org/"
         open_url = self.urlopen(URL)
@@ -94,14 +94,14 @@
     def test_getcode(self):
         # test getcode() with the fancy opener to get 404 error codes
         URL = "http://www.python.org/XXXinvalidXXX"
-        opener = urllib.request.FancyURLopener()
-        self.addCleanup(opener.close)
-        open_url = opener.open(URL)
-        self.addCleanup(open_url.close)
-        #code = open_url.getcode()
-        #self.assertEqual(code, 404)
+        open_url = urllib.request.FancyURLopener().open(URL)
+        try:
+            code = open_url.getcode()
+        finally:
+            open_url.close()
+        self.assertEqual(code, 404)
 
-    def _test_fileno(self):
+    def test_fileno(self):
         if sys.platform in ('win32',):
             # On Windows, socket handles are not file descriptors; this
             # test can't pass on Windows.
@@ -116,7 +116,7 @@
         finally:
             FILE.close()
 
-    def _test_bad_address(self):
+    def test_bad_address(self):
         # Make sure proper exception is raised when connecting to a bogus
         # address.
         self.assertRaises(IOError,
@@ -185,11 +185,9 @@
 
 def test_main():
     support.requires('network')
-    support.run_unittest(
-                         #URLTimeoutTest,
-                         urlopenNetworkTests,
-                         #urlretrieveNetworkTests
-                        )
+    support.run_unittest(URLTimeoutTest,
+                              urlopenNetworkTests,
+                              urlretrieveNetworkTests)
 
 if __name__ == "__main__":
     test_main()

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


More information about the Python-checkins mailing list