@@ -51,7 +51,7 @@ def quiet():
5151
5252# Convert to POSIX path
5353def posix (path ):
54- if six .PY3 and not isinstance (path , str ):
54+ if not six .PY2 and not isinstance (path , str ):
5555 return path .replace (os .sep .encode ('ascii' ), b'/' )
5656 else :
5757 return path .replace (os .sep , '/' )
@@ -329,7 +329,7 @@ def test_manifest_is_read_with_utf8_encoding(self):
329329 cmd .read_manifest ()
330330
331331 # The filelist should contain the UTF-8 filename
332- if six .PY3 :
332+ if not six .PY2 :
333333 filename = filename .decode ('utf-8' )
334334 assert filename in cmd .filelist .files
335335
@@ -383,7 +383,7 @@ def test_sdist_with_utf8_encoded_filename(self):
383383 if sys .platform == 'darwin' :
384384 filename = decompose (filename )
385385
386- if six .PY3 :
386+ if not six .PY2 :
387387 fs_enc = sys .getfilesystemencoding ()
388388
389389 if sys .platform == 'win32' :
@@ -425,7 +425,19 @@ def test_sdist_with_latin1_encoded_filename(self):
425425 with quiet ():
426426 cmd .run ()
427427
428- if six .PY3 :
428+ if six .PY2 :
429+ # Under Python 2 there seems to be no decoded string in the
430+ # filelist. However, due to decode and encoding of the
431+ # file name to get utf-8 Manifest the latin1 maybe excluded
432+ try :
433+ # fs_enc should match how one is expect the decoding to
434+ # be proformed for the manifest output.
435+ fs_enc = sys .getfilesystemencoding ()
436+ filename .decode (fs_enc )
437+ assert filename in cmd .filelist .files
438+ except UnicodeDecodeError :
439+ filename not in cmd .filelist .files
440+ else :
429441 # not all windows systems have a default FS encoding of cp1252
430442 if sys .platform == 'win32' :
431443 # Latin-1 is similar to Windows-1252 however
@@ -440,18 +452,6 @@ def test_sdist_with_latin1_encoded_filename(self):
440452 # The Latin-1 filename should have been skipped
441453 filename = filename .decode ('latin-1' )
442454 filename not in cmd .filelist .files
443- else :
444- # Under Python 2 there seems to be no decoded string in the
445- # filelist. However, due to decode and encoding of the
446- # file name to get utf-8 Manifest the latin1 maybe excluded
447- try :
448- # fs_enc should match how one is expect the decoding to
449- # be proformed for the manifest output.
450- fs_enc = sys .getfilesystemencoding ()
451- filename .decode (fs_enc )
452- assert filename in cmd .filelist .files
453- except UnicodeDecodeError :
454- filename not in cmd .filelist .files
455455
456456 def test_pyproject_toml_in_sdist (self , tmpdir ):
457457 """
0 commit comments