@@ -1172,36 +1172,6 @@ def test_identity(self):
11721172 continue
11731173 self .assertEquals (os .fsdecode (bytesfn ), fn )
11741174
1175- def get_output (self , fs_encoding , func ):
1176- env = os .environ .copy ()
1177- env ['PYTHONIOENCODING' ] = 'utf-8'
1178- env ['PYTHONFSENCODING' ] = fs_encoding
1179- code = 'import os; print(%s, end="")' % func
1180- process = subprocess .Popen (
1181- [sys .executable , "-c" , code ],
1182- stdout = subprocess .PIPE , env = env )
1183- stdout , stderr = process .communicate ()
1184- self .assertEqual (process .returncode , 0 )
1185- return stdout .decode ('utf-8' )
1186-
1187- @unittest .skipIf (sys .platform in ('win32' , 'darwin' ),
1188- 'PYTHONFSENCODING is ignored on Windows and Mac OS X' )
1189- def test_encodings (self ):
1190- def check (encoding , bytesfn , unicodefn ):
1191- encoded = self .get_output (encoding , 'repr(os.fsencode(%a))' % unicodefn )
1192- self .assertEqual (encoded , repr (bytesfn ))
1193-
1194- decoded = self .get_output (encoding , 'repr(os.fsdecode(%a))' % bytesfn )
1195- self .assertEqual (decoded , repr (unicodefn ))
1196-
1197- check ('utf-8' , b'\xc3 \xa9 \x80 ' , '\xe9 \udc80 ' )
1198-
1199- # Raise SkipTest() if sys.executable is not encodable to ascii
1200- support .workaroundIssue8611 ()
1201-
1202- check ('ascii' , b'abc\xff ' , 'abc\udcff ' )
1203- check ('iso-8859-15' , b'\xef \xa4 ' , '\xef \u20ac ' )
1204-
12051175
12061176class PidTests (unittest .TestCase ):
12071177 @unittest .skipUnless (hasattr (os , 'getppid' ), "test needs os.getppid" )
0 commit comments