Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d9e9528

Browse files
Issue #22165: Fixed test_undecodable_filename on Mac OS.
1 parent 87bbf25 commit d9e9528

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/test_httpservers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ def test_undecodable_filename(self):
277277
with open(os.path.join(self.tempdir, filename), 'wb') as f:
278278
f.write(support.TESTFN_UNDECODABLE)
279279
response = self.request(self.tempdir_name + '/')
280+
if sys.platform == 'darwin':
281+
# On Mac OS the HFS+ filesystem replaces bytes that aren't valid
282+
# UTF-8 into a percent-encoded value.
283+
for name in os.listdir(self.tempdir):
284+
if name != 'test': # Ignore a filename created in setUp().
285+
filename = name
286+
break
280287
body = self.check_status_and_reason(response, 200)
281288
quotedname = urllib.parse.quote(filename, errors='surrogatepass')
282289
self.assertIn(('href="%s"' % quotedname)

0 commit comments

Comments
 (0)