[Python-checkins] cpython (2.7): Fix #16450 test_missing_localfile testcase fails on misconfigured hostname.

senthil.kumaran python-checkins at python.org
Sat Jun 1 16:59:25 CEST 2013


http://hg.python.org/cpython/rev/60c195e89c88
changeset:   84005:60c195e89c88
branch:      2.7
parent:      83995:6ceb5bf24da8
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Sat Jun 01 07:59:10 2013 -0700
summary:
  Fix #16450 test_missing_localfile testcase fails on misconfigured hostname.
Refactor test to accomodate that and exercise the needed functionality.

files:
  Lib/test/test_urllib.py |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -227,13 +227,13 @@
                 '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)

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


More information about the Python-checkins mailing list