diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2011-07-31 11:46:24 +0800 |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2011-07-31 11:46:24 +0800 |
commit | 2f7c695b979fc638e2e3f81f8a47d41429c67186 (patch) | |
tree | 66ec03dd91b33345813a09b7e57ebee0446f2aab | |
parent | a7cbf048bf6b6593cec704ad55340c5dad36e2b1 (diff) | |
parent | e324c57367eb8199255825f931731333e9c415c7 (diff) | |
download | cpython-git-2f7c695b979fc638e2e3f81f8a47d41429c67186.tar.gz |
using support.transient_internet helper method in the urllib2net test.
-rw-r--r-- | 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 index cd225c90fd..54f4e0c6ca 100644 --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -178,17 +178,21 @@ class OtherNetworkTests(unittest.TestCase): # 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: - self.assertTrue(res) + 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('http://www.imdb.com') - res = req.read() - self.assertTrue(res) + req = urllib.request.urlopen(URL) + res = req.read() + self.assertTrue(res) def _test_urls(self, urls, handlers, retry=True): import time |