Show More
@@ -14,7 +14,7 b' import unittest' | |||||
14 | from mercurial import pycompat |
|
14 | from mercurial import pycompat | |
15 |
|
15 | |||
16 |
|
16 | |||
17 | CHILD_PROCESS = r''' |
|
17 | BUFFERING_CHILD_SCRIPT = r''' | |
18 | import os |
|
18 | import os | |
19 |
|
19 | |||
20 | from mercurial import dispatch |
|
20 | from mercurial import dispatch | |
@@ -89,7 +89,7 b' class TestStdio(unittest.TestCase):' | |||||
89 | proc = subprocess.Popen( |
|
89 | proc = subprocess.Popen( | |
90 | [sys.executable] |
|
90 | [sys.executable] | |
91 | + python_args |
|
91 | + python_args | |
92 |
+ ['-c', CHILD_ |
|
92 | + ['-c', BUFFERING_CHILD_SCRIPT.format(stream=stream)], | |
93 | stdin=child_stdin, |
|
93 | stdin=child_stdin, | |
94 | stdout=child_stream if stream == 'stdout' else None, |
|
94 | stdout=child_stream if stream == 'stdout' else None, | |
95 | stderr=child_stream if stream == 'stderr' else None, |
|
95 | stderr=child_stream if stream == 'stderr' else None, | |
@@ -106,36 +106,36 b' class TestStdio(unittest.TestCase):' | |||||
106 | retcode = proc.wait() |
|
106 | retcode = proc.wait() | |
107 | self.assertEqual(retcode, 0) |
|
107 | self.assertEqual(retcode, 0) | |
108 |
|
108 | |||
109 | def test_stdout_pipes(self): |
|
109 | def test_buffering_stdout_pipes(self): | |
110 | self._test('stdout', _pipes, FULLY_BUFFERED) |
|
110 | self._test('stdout', _pipes, FULLY_BUFFERED) | |
111 |
|
111 | |||
112 | def test_stdout_ptys(self): |
|
112 | def test_buffering_stdout_ptys(self): | |
113 | self._test('stdout', _ptys, LINE_BUFFERED) |
|
113 | self._test('stdout', _ptys, LINE_BUFFERED) | |
114 |
|
114 | |||
115 | def test_stdout_pipes_unbuffered(self): |
|
115 | def test_buffering_stdout_pipes_unbuffered(self): | |
116 | self._test('stdout', _pipes, UNBUFFERED, python_args=['-u']) |
|
116 | self._test('stdout', _pipes, UNBUFFERED, python_args=['-u']) | |
117 |
|
117 | |||
118 | def test_stdout_ptys_unbuffered(self): |
|
118 | def test_buffering_stdout_ptys_unbuffered(self): | |
119 | self._test('stdout', _ptys, UNBUFFERED, python_args=['-u']) |
|
119 | self._test('stdout', _ptys, UNBUFFERED, python_args=['-u']) | |
120 |
|
120 | |||
121 | if not pycompat.ispy3 and not pycompat.iswindows: |
|
121 | if not pycompat.ispy3 and not pycompat.iswindows: | |
122 | # On Python 2 on non-Windows, we manually open stdout in line-buffered |
|
122 | # On Python 2 on non-Windows, we manually open stdout in line-buffered | |
123 | # mode if connected to a TTY. We should check if Python was configured |
|
123 | # mode if connected to a TTY. We should check if Python was configured | |
124 | # to use unbuffered stdout, but it's hard to do that. |
|
124 | # to use unbuffered stdout, but it's hard to do that. | |
125 | test_stdout_ptys_unbuffered = unittest.expectedFailure( |
|
125 | test_buffering_stdout_ptys_unbuffered = unittest.expectedFailure( | |
126 | test_stdout_ptys_unbuffered |
|
126 | test_buffering_stdout_ptys_unbuffered | |
127 | ) |
|
127 | ) | |
128 |
|
128 | |||
129 | def test_stderr_pipes(self): |
|
129 | def test_buffering_stderr_pipes(self): | |
130 | self._test('stderr', _pipes, UNBUFFERED) |
|
130 | self._test('stderr', _pipes, UNBUFFERED) | |
131 |
|
131 | |||
132 | def test_stderr_ptys(self): |
|
132 | def test_buffering_stderr_ptys(self): | |
133 | self._test('stderr', _ptys, UNBUFFERED) |
|
133 | self._test('stderr', _ptys, UNBUFFERED) | |
134 |
|
134 | |||
135 | def test_stderr_pipes_unbuffered(self): |
|
135 | def test_buffering_stderr_pipes_unbuffered(self): | |
136 | self._test('stderr', _pipes, UNBUFFERED, python_args=['-u']) |
|
136 | self._test('stderr', _pipes, UNBUFFERED, python_args=['-u']) | |
137 |
|
137 | |||
138 | def test_stderr_ptys_unbuffered(self): |
|
138 | def test_buffering_stderr_ptys_unbuffered(self): | |
139 | self._test('stderr', _ptys, UNBUFFERED, python_args=['-u']) |
|
139 | self._test('stderr', _ptys, UNBUFFERED, python_args=['-u']) | |
140 |
|
140 | |||
141 |
|
141 |
General Comments 0
You need to be logged in to leave comments.
Login now