Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Lib/test/test_cmd_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,13 @@ def test_osx_android_utf8(self):
self.assertEqual(p.returncode, 0)

def test_non_interactive_output_buffering(self):
PYTHONUNBUFFERED = "PYTHONUNBUFFERED"
python_unbuffered_value = os.environ.get(PYTHONUNBUFFERED, "0")
python_unbuffered_on = python_unbuffered_value != "0"
if python_unbuffered_on:
# we expect buffered stdio
os.environ[PYTHONUNBUFFERED] = "0"

code = textwrap.dedent("""
import sys
out = sys.stdout
Expand All @@ -351,6 +358,10 @@ def test_non_interactive_output_buffering(self):
'False False False\n'
'False False True\n')

if python_unbuffered_on:
# restore original value
os.environ[PYTHONUNBUFFERED] = python_unbuffered_value

def test_unbuffered_output(self):
# Test expected operation of the '-u' switch
for stream in ('stdout', 'stderr'):
Expand Down
Loading