]> granicus.if.org Git - python/commitdiff
Decompose TESTFN_UNICODE on Mac OS X
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 18 Aug 2010 21:06:23 +0000 (21:06 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 18 Aug 2010 21:06:23 +0000 (21:06 +0000)
Lib/test/support.py

index a70fee48cfbda60b47c4da643841efa21fabafd2..d0e84c72ab7d006d96a8a313df7c3368d1d219f4 100644 (file)
@@ -379,6 +379,12 @@ TESTFN = "{}_{}_tmp".format(TESTFN, os.getpid())
 
 # TESTFN_UNICODE is a non-ascii filename
 TESTFN_UNICODE = TESTFN + "-\xe0\xf2\u0258\u0141\u011f"
+if sys.platform == 'darwin':
+    # In Mac OS X's VFS API file names are, by definition, canonically
+    # decomposed Unicode, encoded using UTF-8. See QA1173:
+    # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+    import unicodedata
+    TESTFN_UNICODE = unicodedata.normalize('NFD', TESTFN_UNICODE)
 TESTFN_ENCODING = sys.getfilesystemencoding()
 
 # TESTFN_UNENCODABLE is a filename (str type) that should *not* be able to be