File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -299,8 +299,7 @@ def test_abspath_issue3426(self):
299299
300300 unicwd = '\xe7 w\xf0 '
301301 try :
302- fsencoding = support .TESTFN_ENCODING or "ascii"
303- unicwd .encode (fsencoding )
302+ os .fsencode (unicwd )
304303 except (AttributeError , UnicodeEncodeError ):
305304 # FS encoding is probably ASCII
306305 pass
@@ -312,10 +311,19 @@ def test_abspath_issue3426(self):
312311 @unittest .skipIf (sys .platform == 'darwin' ,
313312 "Mac OS X denies the creation of a directory with an invalid utf8 name" )
314313 def test_nonascii_abspath (self ):
314+ name = b'\xe7 w\xf0 '
315+ if sys .platform == 'win32' :
316+ try :
317+ os .fsdecode (name )
318+ except UnicodeDecodeError :
319+ self .skipTest ("the filename %a is not decodable "
320+ "from the ANSI code page %s"
321+ % (name , sys .getfilesystemencoding ()))
322+
315323 # Test non-ASCII, non-UTF8 bytes in the path.
316324 with warnings .catch_warnings ():
317325 warnings .simplefilter ("ignore" , DeprecationWarning )
318- with support .temp_cwd (b' \xe7 w \xf0 ' ):
326+ with support .temp_cwd (name ):
319327 self .test_abspath ()
320328
321329
You can’t perform that action at this time.
0 commit comments