[Python-checkins] cpython (merge 3.4 -> default): Issue #22165: Fixed test_undecodable_filename on Mac OS.

serhiy.storchaka python-checkins at python.org
Sun Aug 17 15:59:15 CEST 2014


http://hg.python.org/cpython/rev/58e0d2c3ead8
changeset:   92137:58e0d2c3ead8
parent:      92135:f44f5daff665
parent:      92136:b05d4f3ee190
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Aug 17 16:58:11 2014 +0300
summary:
  Issue #22165: Fixed test_undecodable_filename on Mac OS.

files:
  Lib/test/test_httpservers.py |  7 +++++++
  1 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -277,6 +277,13 @@
         with open(os.path.join(self.tempdir, filename), 'wb') as f:
             f.write(support.TESTFN_UNDECODABLE)
         response = self.request(self.tempdir_name + '/')
+        if sys.platform == 'darwin':
+            # On Mac OS the HFS+ filesystem replaces bytes that aren't valid
+            # UTF-8 into a percent-encoded value.
+            for name in os.listdir(self.tempdir):
+                if name != 'test': # Ignore a filename created in setUp().
+                    filename = name
+                    break
         body = self.check_status_and_reason(response, 200)
         quotedname = urllib.parse.quote(filename, errors='surrogatepass')
         self.assertIn(('href="%s"' % quotedname)

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


More information about the Python-checkins mailing list