Ejemplo n.º 1
0
 def addCaptureToErr(self, ev, output):
     ev = exc_to_unicode(ev)
     output = force_unicode(output)
     return u'\n'.join([
         ev,
         ln(u'>> begin captured stderr <<'), output,
         ln(u'>> end captured stderr <<')
     ])
Ejemplo n.º 2
0
 def addCaptureToErr(self, ev, output):
     ev = exc_to_unicode(ev)
     output = force_unicode(output)      
     return u'\n'.join([
         ev,
         ln(u'>> begin captured stderr <<'),
         output,
         ln(u'>> end captured stderr <<')
     ])
Ejemplo n.º 3
0
    def formatFailure(self, test, err):
        """Add detail from traceback inspection to error message of a failure.
        """
        ec, ev, tb = err
        tbinfo, str_ev = None, exc_to_unicode(ev)

        if tb:
            tbinfo = force_unicode(inspect_traceback(tb))
            str_ev = '\n'.join([str_ev, tbinfo])
        test.tbinfo = tbinfo
        return (ec, str_ev, tb)
Ejemplo n.º 4
0
 def addCaptureToErr(self, ev, output, output_exc_info=None):
     # If given, output_exc_info should be a 3-tuple from sys.exc_info(),
     # from an exception raised while trying to get the captured output.
     ev = exc_to_unicode(ev)
     output = force_unicode(output)
     error_text = [ev, ln(u'>> begin captured stdout <<'),
                   output, ln(u'>> end captured stdout <<')]
     if output_exc_info:
         error_text.extend([u'OUTPUT ERROR: Could not get captured output.',
                            # <https://github.com/python/cpython/blob/2.7/Lib/StringIO.py#L258>
                            # <https://github.com/nose-devs/nose/issues/816>
                            u"The test might've printed both 'unicode' strings and non-ASCII 8-bit 'str' strings.",
                            ln(u'>> begin captured stdout exception traceback <<'),
                            u''.join(traceback.format_exception(*output_exc_info)),
                            ln(u'>> end captured stdout exception traceback <<')])
     return u'\n'.join(error_text)
Ejemplo n.º 5
0
 def addCaptureToErr(self, ev, output):
     ev = exc_to_unicode(ev)
     output = force_unicode(output)
     return u"\n".join([ev, output])