summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2013-06-01 14:59:10 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2013-06-01 14:59:10 (GMT)
commita085f000b4ecf409ef29e38431ebbd198e7bbb31 (patch)
treef2bce6c6f41eafbb34020f69b2aae53d3f74c177 /Lib/test/test_urllib.py
parent95787fdb9ced641a4973dce59ccf44cc960424e8 (diff)
downloadcpython-a085f000b4ecf409ef29e38431ebbd198e7bbb31.zip
cpython-a085f000b4ecf409ef29e38431ebbd198e7bbb31.tar.gz
cpython-a085f000b4ecf409ef29e38431ebbd198e7bbb31.tar.bz2
Fix #16450 test_missing_localfile testcase fails on misconfigured hostname.
Refactor test to accomodate that and exercise the needed functionality.
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r--Lib/test/test_urllib.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 3a273f8..e60adb2 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -227,13 +227,13 @@ Content-Type: text/html; charset=iso-8859-1
'file://localhost/a/missing/file.py')
fd, tmp_file = tempfile.mkstemp()
tmp_fileurl = 'file://localhost/' + tmp_file.replace(os.path.sep, '/')
+ self.assertTrue(os.path.exists(tmp_file))
try:
- self.assertTrue(os.path.exists(tmp_file))
fp = urllib.urlopen(tmp_fileurl)
+ fp.close()
finally:
os.close(fd)
- fp.close()
- os.unlink(tmp_file)
+ os.unlink(tmp_file)
self.assertFalse(os.path.exists(tmp_file))
self.assertRaises(IOError, urllib.urlopen, tmp_fileurl)