[Python-checkins] cpython (merge 3.2 -> default): using support.transient_internet helper method in the urllib2net test.

senthil.kumaran python-checkins at python.org
Sun Jul 31 05:50:37 CEST 2011


http://hg.python.org/cpython/rev/6bbe07737027
changeset: 71651:6bbe07737027
parent: 71647:86307a32a99a
parent: 71650:17e082be4043
user: Senthil Kumaran <senthil at uthcode.com>
date: Sun Jul 31 11:46:24 2011 +0800
summary:
 using support.transient_internet helper method in the urllib2net test.
files:
 Lib/test/test_urllib2net.py | 24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
--- a/Lib/test/test_urllib2net.py
+++ b/Lib/test/test_urllib2net.py
@@ -178,18 +178,22 @@
 # Some sites do not send Connection: close header.
 # Verify that those work properly. (#issue12576)
 
- try:
- with urllib.request.urlopen('http://www.imdb.com') as res:
- pass
- except ValueError as e:
- self.fail("urlopen failed for sites not sending Connection:close")
- else:
+ URL = 'http://www.imdb.com' # mangles Connection:close
+
+ with support.transient_internet(URL):
+ try:
+ with urllib.request.urlopen(URL) as res:
+ pass
+ except ValueError as e:
+ self.fail("urlopen failed for site not sending \
+ Connection:close")
+ else:
+ self.assertTrue(res)
+
+ req = urllib.request.urlopen(URL)
+ res = req.read()
 self.assertTrue(res)
 
- req = urllib.request.urlopen('http://www.imdb.com')
- res = req.read()
- self.assertTrue(res)
-
 def _test_urls(self, urls, handlers, retry=True):
 import time
 import logging
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /