Show More
@@ -87,7 +87,7 b' def parse_test_output(txt):' | |||
|
87 | 87 | txt : str |
|
88 | 88 | Text output of a test run, assumed to contain a line of one of the |
|
89 | 89 | following forms:: |
|
90 | ||
|
90 | ||
|
91 | 91 | 'FAILED (errors=1)' |
|
92 | 92 | 'FAILED (failures=1)' |
|
93 | 93 | 'FAILED (errors=1, failures=1)' |
@@ -186,7 +186,7 b' def ipexec(fname, options=None, commands=()):' | |||
|
186 | 186 | |
|
187 | 187 | Returns |
|
188 | 188 | ------- |
|
189 | (stdout, stderr) of ipython subprocess. | |
|
189 | ``(stdout, stderr)`` of ipython subprocess. | |
|
190 | 190 | """ |
|
191 | 191 | if options is None: options = [] |
|
192 | 192 | |
@@ -333,13 +333,13 b' notprinted_msg = """Did not find {0!r} in printed output (on {1}):' | |||
|
333 | 333 | |
|
334 | 334 | class AssertPrints(object): |
|
335 | 335 | """Context manager for testing that code prints certain text. |
|
336 | ||
|
336 | ||
|
337 | 337 | Examples |
|
338 | 338 | -------- |
|
339 | 339 | >>> with AssertPrints("abc", suppress=False): |
|
340 | 340 | ... print("abcd") |
|
341 | 341 | ... print("def") |
|
342 |
... |
|
|
342 | ... | |
|
343 | 343 | abcd |
|
344 | 344 | def |
|
345 | 345 | """ |
@@ -349,13 +349,13 b' class AssertPrints(object):' | |||
|
349 | 349 | self.s = [self.s] |
|
350 | 350 | self.channel = channel |
|
351 | 351 | self.suppress = suppress |
|
352 | ||
|
352 | ||
|
353 | 353 | def __enter__(self): |
|
354 | 354 | self.orig_stream = getattr(sys, self.channel) |
|
355 | 355 | self.buffer = MyStringIO() |
|
356 | 356 | self.tee = Tee(self.buffer, channel=self.channel) |
|
357 | 357 | setattr(sys, self.channel, self.buffer if self.suppress else self.tee) |
|
358 | ||
|
358 | ||
|
359 | 359 | def __exit__(self, etype, value, traceback): |
|
360 | 360 | try: |
|
361 | 361 | if value is not None: |
@@ -381,7 +381,7 b' printed_msg = """Found {0!r} in printed output (on {1}):' | |||
|
381 | 381 | |
|
382 | 382 | class AssertNotPrints(AssertPrints): |
|
383 | 383 | """Context manager for checking that certain output *isn't* produced. |
|
384 | ||
|
384 | ||
|
385 | 385 | Counterpart of AssertPrints""" |
|
386 | 386 | def __exit__(self, etype, value, traceback): |
|
387 | 387 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now