@@ -336,23 +336,21 @@ def test_osx_android_utf8(self):
336336 self .assertEqual (stdout , expected )
337337 self .assertEqual (p .returncode , 0 )
338338
339+ @unittest .skipIf (os .environ .get ("PYTHONUNBUFFERED" , "0" ) != "0" , "Python stdio buffering is disabled." )
339340 def test_non_interactive_output_buffering (self ):
340- with os_helper .EnvironmentVarGuard () as environ :
341- # we expect buffered stdio
342- environ ["PYTHONUNBUFFERED" ] = "0"
343- code = textwrap .dedent ("""
344- import sys
345- out = sys.stdout
346- print(out.isatty(), out.write_through, out.line_buffering)
347- err = sys.stderr
348- print(err.isatty(), err.write_through, err.line_buffering)
349- """ )
350- args = [sys .executable , '-c' , code ]
351- proc = subprocess .run (args , stdout = subprocess .PIPE ,
352- stderr = subprocess .PIPE , text = True , check = True )
353- self .assertEqual (proc .stdout ,
354- 'False False False\n '
355- 'False False True\n ' )
341+ code = textwrap .dedent ("""
342+ import sys
343+ out = sys.stdout
344+ print(out.isatty(), out.write_through, out.line_buffering)
345+ err = sys.stderr
346+ print(err.isatty(), err.write_through, err.line_buffering)
347+ """ )
348+ args = [sys .executable , '-c' , code ]
349+ proc = subprocess .run (args , stdout = subprocess .PIPE ,
350+ stderr = subprocess .PIPE , text = True , check = True )
351+ self .assertEqual (proc .stdout ,
352+ 'False False False\n '
353+ 'False False True\n ' )
356354
357355 def test_unbuffered_output (self ):
358356 # Test expected operation of the '-u' switch
0 commit comments