From: Serhiy Storchaka Date: Sun, 17 Aug 2014 13:57:39 +0000 (+0300) Subject: Issue #22165: Fixed test_undecodable_filename on Mac OS. X-Git-Tag: v3.4.2rc1~108 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d9e9528818ca54831a64a624a59b4e9d74d2ef4e;p=thirdparty%2FPython%2Fcpython.git Issue #22165: Fixed test_undecodable_filename on Mac OS. --- diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index ad058b5efa48..f164054748f3 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -277,6 +277,13 @@ class SimpleHTTPServerTestCase(BaseTestCase): 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)