Show More
@@ -22,7 +22,7 b' from IPython.parallel.error import TimeoutError' | |||||
22 |
|
22 | |||
23 | from IPython.parallel import error, Client |
|
23 | from IPython.parallel import error, Client | |
24 | from IPython.parallel.tests import add_engines |
|
24 | from IPython.parallel.tests import add_engines | |
25 | from .clienttest import ClusterTestCase |
|
25 | from .clienttest import ClusterTestCase, capture_output | |
26 |
|
26 | |||
27 | def setup(): |
|
27 | def setup(): | |
28 | add_engines(2, total=True) |
|
28 | add_engines(2, total=True) | |
@@ -202,4 +202,63 b' class AsyncResultTest(ClusterTestCase):' | |||||
202 | finally: |
|
202 | finally: | |
203 | rc2.close() |
|
203 | rc2.close() | |
204 |
|
204 | |||
|
205 | def test_display_empty_streams_single(self): | |||
|
206 | """empty stdout/err are not displayed (single result)""" | |||
|
207 | self.minimum_engines(1) | |||
|
208 | ||||
|
209 | v = self.client[-1] | |||
|
210 | ar = v.execute("print (5555)") | |||
|
211 | ar.get(5) | |||
|
212 | with capture_output() as io: | |||
|
213 | ar.display_outputs() | |||
|
214 | self.assertEquals(io.stderr, '') | |||
|
215 | self.assertTrue('5555' in io.stdout) | |||
|
216 | ||||
|
217 | ar = v.execute("a=5") | |||
|
218 | ar.get(5) | |||
|
219 | with capture_output() as io: | |||
|
220 | ar.display_outputs() | |||
|
221 | self.assertEquals(io.stderr, '') | |||
|
222 | self.assertEquals(io.stdout, '') | |||
|
223 | ||||
|
224 | def test_display_empty_streams_type(self): | |||
|
225 | """empty stdout/err are not displayed (groupby type)""" | |||
|
226 | self.minimum_engines(1) | |||
|
227 | ||||
|
228 | v = self.client[:] | |||
|
229 | ar = v.execute("print (5555)") | |||
|
230 | ar.get(5) | |||
|
231 | with capture_output() as io: | |||
|
232 | ar.display_outputs() | |||
|
233 | self.assertEquals(io.stderr, '') | |||
|
234 | self.assertEquals(io.stdout.count('5555'), len(v), io.stdout) | |||
|
235 | self.assertEquals(io.stdout.count('[stdout:'), len(v), io.stdout) | |||
|
236 | ||||
|
237 | ar = v.execute("a=5") | |||
|
238 | ar.get(5) | |||
|
239 | with capture_output() as io: | |||
|
240 | ar.display_outputs() | |||
|
241 | self.assertEquals(io.stderr, '') | |||
|
242 | self.assertEquals(io.stdout, '') | |||
|
243 | ||||
|
244 | def test_display_empty_streams_engine(self): | |||
|
245 | """empty stdout/err are not displayed (groupby engine)""" | |||
|
246 | self.minimum_engines(1) | |||
|
247 | ||||
|
248 | v = self.client[:] | |||
|
249 | ar = v.execute("print (5555)") | |||
|
250 | ar.get(5) | |||
|
251 | with capture_output() as io: | |||
|
252 | ar.display_outputs('engine') | |||
|
253 | self.assertEquals(io.stderr, '') | |||
|
254 | self.assertEquals(io.stdout.count('5555'), len(v), io.stdout) | |||
|
255 | self.assertEquals(io.stdout.count('[stdout:'), len(v), io.stdout) | |||
|
256 | ||||
|
257 | ar = v.execute("a=5") | |||
|
258 | ar.get(5) | |||
|
259 | with capture_output() as io: | |||
|
260 | ar.display_outputs('engine') | |||
|
261 | self.assertEquals(io.stderr, '') | |||
|
262 | self.assertEquals(io.stdout, '') | |||
|
263 | ||||
205 |
|
264 |
General Comments 0
You need to be logged in to leave comments.
Login now