104 raise |
104 raise |
105 finally: |
105 finally: |
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 |
142 if __name__ == '__main__': |
142 if __name__ == '__main__': |
143 import silenttestrunner |
143 import silenttestrunner |