Issue #16702: Skip proxies for localhost in urllib2_localnet tests
authorSenthil Kumaran <senthil@uthcode.com>
Wed, 26 Dec 2012 09:45:22 +0000 (01:45 -0800)
committerSenthil Kumaran <senthil@uthcode.com>
Wed, 26 Dec 2012 09:45:22 +0000 (01:45 -0800)
Lib/test/test_urllib2_localnet.py
Misc/NEWS

index 0fda77090175b13cf292baafa406e8f5f78afb57..ec3437597d869b8fc1e923eb6ed85721ccb39949 100644 (file)
@@ -5,7 +5,9 @@ import urllib2
 import BaseHTTPServer
 import unittest
 import hashlib
+
 from test import test_support
+
 mimetools = test_support.import_module('mimetools', deprecated=True)
 threading = test_support.import_module('threading')
 
@@ -346,6 +348,12 @@ class TestUrlopen(BaseTestCase):
     for transparent redirection have been written.
     """
 
+    def setUp(self):
+        proxy_handler = urllib2.ProxyHandler({})
+        opener = urllib2.build_opener(proxy_handler)
+        urllib2.install_opener(opener)
+        super(TestUrlopen, self).setUp()
+
     def start_server(self, responses):
         handler = GetRequestHandler(responses)
 
index 58a637455b7b35440dbb78131a6e18615c41823d..381b09159428a9e2bd020cb8d5dfb3f998b2dfed 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -164,6 +164,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #16702: test_urllib2_localnet tests now correctly ignores proxies for
+  localhost tests.
+
 - Issue #16713: Fix the parsing of tel url with params using urlparse module.
 
 - Issue #16443: Add docstrings to regular expression match objects.