]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Undo an accidental commit.
authorBrett Cannon <brett@python.org>
Tue, 15 Mar 2011 22:48:52 +0000 (18:48 -0400)
committerBrett Cannon <brett@python.org>
Tue, 15 Mar 2011 22:48:52 +0000 (18:48 -0400)
Lib/test/test_urllibnet.py

index adfc9eddbcae8d30cab2aed50786b2efdcc3783a..c8851031e894b30f316cbfccd317a92ba13b402c 100644 (file)
@@ -46,7 +46,7 @@ class urlopenNetworkTests(unittest.TestCase):
         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 @@ class urlopenNetworkTests(unittest.TestCase):
         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 @@ class urlopenNetworkTests(unittest.TestCase):
         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 @@ class urlopenNetworkTests(unittest.TestCase):
                                   "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 @@ class urlopenNetworkTests(unittest.TestCase):
     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)
-
-    def _test_fileno(self):
+        open_url = urllib.request.FancyURLopener().open(URL)
+        try:
+            code = open_url.getcode()
+        finally:
+            open_url.close()
+        self.assertEqual(code, 404)
+
+    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 @@ class urlopenNetworkTests(unittest.TestCase):
         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 @@ class urlretrieveNetworkTests(unittest.TestCase):
 
 def test_main():
     support.requires('network')
-    support.run_unittest(
-                         #URLTimeoutTest,
-                         urlopenNetworkTests,
-                         #urlretrieveNetworkTests
-                        )
+    support.run_unittest(URLTimeoutTest,
+                              urlopenNetworkTests,
+                              urlretrieveNetworkTests)
 
 if __name__ == "__main__":
     test_main()