Show More
@@ -58,6 +58,13 b' def _closing(fds):' | |||||
58 |
|
58 | |||
59 |
|
59 | |||
60 | @contextlib.contextmanager |
|
60 | @contextlib.contextmanager | |
|
61 | def _devnull(): | |||
|
62 | devnull = os.open(os.devnull, os.O_WRONLY) | |||
|
63 | with _closing([devnull]): | |||
|
64 | yield (None, devnull) | |||
|
65 | ||||
|
66 | ||||
|
67 | @contextlib.contextmanager | |||
61 | def _pipes(): |
|
68 | def _pipes(): | |
62 | rwpair = os.pipe() |
|
69 | rwpair = os.pipe() | |
63 | with _closing(rwpair): |
|
70 | with _closing(rwpair): | |
@@ -115,6 +122,7 b' class TestStdio(unittest.TestCase):' | |||||
115 | ) |
|
122 | ) | |
116 | try: |
|
123 | try: | |
117 | os.close(child_stream) |
|
124 | os.close(child_stream) | |
|
125 | if stream_receiver is not None: | |||
118 | check_output(stream_receiver, proc) |
|
126 | check_output(stream_receiver, proc) | |
119 | except: # re-raises |
|
127 | except: # re-raises | |
120 | proc.terminate() |
|
128 | proc.terminate() | |
@@ -137,12 +145,18 b' class TestStdio(unittest.TestCase):' | |||||
137 | python_args, |
|
145 | python_args, | |
138 | ) |
|
146 | ) | |
139 |
|
147 | |||
|
148 | def test_buffering_stdout_devnull(self): | |||
|
149 | self._test_buffering('stdout', _devnull, None) | |||
|
150 | ||||
140 | def test_buffering_stdout_pipes(self): |
|
151 | def test_buffering_stdout_pipes(self): | |
141 | self._test_buffering('stdout', _pipes, FULLY_BUFFERED) |
|
152 | self._test_buffering('stdout', _pipes, FULLY_BUFFERED) | |
142 |
|
153 | |||
143 | def test_buffering_stdout_ptys(self): |
|
154 | def test_buffering_stdout_ptys(self): | |
144 | self._test_buffering('stdout', _ptys, LINE_BUFFERED) |
|
155 | self._test_buffering('stdout', _ptys, LINE_BUFFERED) | |
145 |
|
156 | |||
|
157 | def test_buffering_stdout_devnull_unbuffered(self): | |||
|
158 | self._test_buffering('stdout', _devnull, None, python_args=['-u']) | |||
|
159 | ||||
146 | def test_buffering_stdout_pipes_unbuffered(self): |
|
160 | def test_buffering_stdout_pipes_unbuffered(self): | |
147 | self._test_buffering('stdout', _pipes, UNBUFFERED, python_args=['-u']) |
|
161 | self._test_buffering('stdout', _pipes, UNBUFFERED, python_args=['-u']) | |
148 |
|
162 | |||
@@ -188,24 +202,36 b' class TestStdio(unittest.TestCase):' | |||||
188 | python_args, |
|
202 | python_args, | |
189 | ) |
|
203 | ) | |
190 |
|
204 | |||
|
205 | def test_large_write_stdout_devnull(self): | |||
|
206 | self._test_large_write('stdout', _devnull) | |||
|
207 | ||||
191 | def test_large_write_stdout_pipes(self): |
|
208 | def test_large_write_stdout_pipes(self): | |
192 | self._test_large_write('stdout', _pipes) |
|
209 | self._test_large_write('stdout', _pipes) | |
193 |
|
210 | |||
194 | def test_large_write_stdout_ptys(self): |
|
211 | def test_large_write_stdout_ptys(self): | |
195 | self._test_large_write('stdout', _ptys) |
|
212 | self._test_large_write('stdout', _ptys) | |
196 |
|
213 | |||
|
214 | def test_large_write_stdout_devnull_unbuffered(self): | |||
|
215 | self._test_large_write('stdout', _devnull, python_args=['-u']) | |||
|
216 | ||||
197 | def test_large_write_stdout_pipes_unbuffered(self): |
|
217 | def test_large_write_stdout_pipes_unbuffered(self): | |
198 | self._test_large_write('stdout', _pipes, python_args=['-u']) |
|
218 | self._test_large_write('stdout', _pipes, python_args=['-u']) | |
199 |
|
219 | |||
200 | def test_large_write_stdout_ptys_unbuffered(self): |
|
220 | def test_large_write_stdout_ptys_unbuffered(self): | |
201 | self._test_large_write('stdout', _ptys, python_args=['-u']) |
|
221 | self._test_large_write('stdout', _ptys, python_args=['-u']) | |
202 |
|
222 | |||
|
223 | def test_large_write_stderr_devnull(self): | |||
|
224 | self._test_large_write('stderr', _devnull) | |||
|
225 | ||||
203 | def test_large_write_stderr_pipes(self): |
|
226 | def test_large_write_stderr_pipes(self): | |
204 | self._test_large_write('stderr', _pipes) |
|
227 | self._test_large_write('stderr', _pipes) | |
205 |
|
228 | |||
206 | def test_large_write_stderr_ptys(self): |
|
229 | def test_large_write_stderr_ptys(self): | |
207 | self._test_large_write('stderr', _ptys) |
|
230 | self._test_large_write('stderr', _ptys) | |
208 |
|
231 | |||
|
232 | def test_large_write_stderr_devnull_unbuffered(self): | |||
|
233 | self._test_large_write('stderr', _devnull, python_args=['-u']) | |||
|
234 | ||||
209 | def test_large_write_stderr_pipes_unbuffered(self): |
|
235 | def test_large_write_stderr_pipes_unbuffered(self): | |
210 | self._test_large_write('stderr', _pipes, python_args=['-u']) |
|
236 | self._test_large_write('stderr', _pipes, python_args=['-u']) | |
211 |
|
237 |
General Comments 0
You need to be logged in to leave comments.
Login now