mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-30404: The -u option now makes the stdout and stderr streams totally unbuffered. (#1667)
This commit is contained in:
parent
0b5e61ddca
commit
77732be801
4 changed files with 17 additions and 12 deletions
|
@ -221,13 +221,12 @@ class CmdLineTest(unittest.TestCase):
|
|||
rc, out, err = assert_python_ok('-u', '-c', code)
|
||||
data = err if stream == 'stderr' else out
|
||||
self.assertEqual(data, b'x', "binary %s not unbuffered" % stream)
|
||||
# Text is line-buffered
|
||||
code = ("import os, sys; sys.%s.write('x\\n'); os._exit(0)"
|
||||
# Text is unbuffered
|
||||
code = ("import os, sys; sys.%s.write('x'); os._exit(0)"
|
||||
% stream)
|
||||
rc, out, err = assert_python_ok('-u', '-c', code)
|
||||
data = err if stream == 'stderr' else out
|
||||
self.assertEqual(data.strip(), b'x',
|
||||
"text %s not line-buffered" % stream)
|
||||
self.assertEqual(data, b'x', "text %s not unbuffered" % stream)
|
||||
|
||||
def test_unbuffered_input(self):
|
||||
# sys.stdin still works with '-u'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue