[Python-checkins] cpython (2.7): Issue #16702: Skip proxies for localhost in urllib2_localnet tests

senthil.kumaran python-checkins at python.org
Wed Dec 26 10:47:28 CET 2012


http://hg.python.org/cpython/rev/6c186caa6285
changeset:   81058:6c186caa6285
branch:      2.7
parent:      81050:ecf3cd3af502
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Wed Dec 26 01:45:22 2012 -0800
summary:
  Issue #16702: Skip proxies for localhost in urllib2_localnet tests

files:
  Lib/test/test_urllib2_localnet.py |  8 ++++++++
  Misc/NEWS                         |  3 +++
  2 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -5,7 +5,9 @@
 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 @@
     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)
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -164,6 +164,9 @@
 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.

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


More information about the Python-checkins mailing list