changeset: 92137:58e0d2c3ead8 parent: 92135:f44f5daff665 parent: 92136:b05d4f3ee190 user: Serhiy Storchaka date: Sun Aug 17 16:58:11 2014 +0300 description: Issue #22165: Fixed test_undecodable_filename on Mac OS. diff -r f44f5daff665 -r 58e0d2c3ead8 Lib/test/test_httpservers.py --- a/Lib/test/test_httpservers.py Sun Aug 17 15:32:42 2014 +0300 +++ b/Lib/test/test_httpservers.py Sun Aug 17 16:58:11 2014 +0300 @@ -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)