Show More
@@ -557,14 +557,16 b' class EmbeddedSphinxShell(object):' | |||||
557 | if self.directive.state: |
|
557 | if self.directive.state: | |
558 | filename = self.directive.state.document.current_source |
|
558 | filename = self.directive.state.document.current_source | |
559 | lineno = self.directive.state.document.current_line |
|
559 | lineno = self.directive.state.document.current_line | |
560 |
|
560 | |||
561 | # Use sphinx logger for warnings |
|
561 | # Use sphinx logger for warnings | |
562 | logger = logging.getLogger(__name__) |
|
562 | logger = logging.getLogger(__name__) | |
563 |
|
563 | |||
564 | # output any exceptions raised during execution to stdout |
|
564 | # output any exceptions raised during execution to stdout | |
565 | # unless :okexcept: has been specified. |
|
565 | # unless :okexcept: has been specified. | |
566 | if not is_okexcept and (("Traceback" in processed_output) or ("SyntaxError" in processed_output)): |
|
566 | if not is_okexcept and ( | |
567 | s = '\n>>>' + ('-' * 73) + '\n' |
|
567 | ("Traceback" in processed_output) or ("SyntaxError" in processed_output) | |
|
568 | ): | |||
|
569 | s = "\n>>>" + ("-" * 73) + "\n" | |||
568 | s += "Exception in %s at block ending on line %s\n" % (filename, lineno) |
|
570 | s += "Exception in %s at block ending on line %s\n" % (filename, lineno) | |
569 | s += "Specify :okexcept: as an option in the ipython:: block to suppress this message\n" |
|
571 | s += "Specify :okexcept: as an option in the ipython:: block to suppress this message\n" | |
570 | s += processed_output + "\n" |
|
572 | s += processed_output + "\n" | |
@@ -577,13 +579,14 b' class EmbeddedSphinxShell(object):' | |||||
577 | # unless :okwarning: has been specified. |
|
579 | # unless :okwarning: has been specified. | |
578 | if not is_okwarning: |
|
580 | if not is_okwarning: | |
579 | for w in ws: |
|
581 | for w in ws: | |
580 |
s = |
|
582 | s = "\n>>>" + ("-" * 73) + "\n" | |
581 | s += "Warning in %s at block ending on line %s\n" % (filename, lineno) |
|
583 | s += "Warning in %s at block ending on line %s\n" % (filename, lineno) | |
582 | s += "Specify :okwarning: as an option in the ipython:: block to suppress this message\n" |
|
584 | s += "Specify :okwarning: as an option in the ipython:: block to suppress this message\n" | |
583 |
s += ( |
|
585 | s += ("-" * 76) + "\n" | |
584 |
s += warnings.formatwarning( |
|
586 | s += warnings.formatwarning( | |
585 |
|
|
587 | w.message, w.category, w.filename, w.lineno, w.line | |
586 |
|
|
588 | ) | |
|
589 | s += "<<<" + ("-" * 73) | |||
587 | logger.warning(s) |
|
590 | logger.warning(s) | |
588 | if self.warning_is_error: |
|
591 | if self.warning_is_error: | |
589 | raise RuntimeError('Non Expected warning in `{}` line {}'.format(filename, lineno)) |
|
592 | raise RuntimeError('Non Expected warning in `{}` line {}'.format(filename, lineno)) |
General Comments 0
You need to be logged in to leave comments.
Login now