Esempio n. 1
0
    def formatTraceback(self, err):
        """Used to format the traceback on test fail or error.

        ``err`` is the output of ``sys.exc_info()`` for the failure.
        
        ``formatTraceback`` returns a string.
        """
        return formatTraceback(self, err)
Esempio n. 2
0
 def _exc_info_to_string(self, err, test):
     formatTraceback = getattr(test, 'formatTraceback', None)
     if formatTraceback is not None:
         traceback = test.formatTraceback(err)
     else:
         traceback = util.formatTraceback(test, err)
     
     msgLines = []
     if self.buffer:
         output = sys.stdout.getvalue()
         error = sys.stderr.getvalue()            
         if output:
             if not output.endswith('\n'):
                 output += '\n'
             msgLines.append(STDOUT_LINE % output)
         if error:
             if not error.endswith('\n'):
                 error += '\n'
             msgLines.append(STDERR_LINE % error)
     return traceback + ''.join(msgLines)