def _exc_info_to_string(self, err, test):
        """
        Converts a sys.exc_info()-style tuple of values into a string.
        """
        exctype, value, tb = err
        # Skip test runner traceback levels
        while tb and self._is_relevant_tb_level(tb):
            tb = tb.tb_next
        if exctype is test.failureException:
            # Skip assert*() traceback levels
            length = self._count_relevant_tb_levels(tb)
            msgLines = traceback.format_exception(exctype, value, tb, length)
        else:
            msgLines = traceback.format_exception(exctype, value, tb)

        if self.buffer:
            output = self._stdout_buffer.getvalue()
            error = self._stderr_buffer.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 ''.join(msgLines)
def _exc_info_to_string ( self , err , test ) : exctype , value , tb = err while tb and self . _is_relevant_tb_level ( tb ) : tb = tb . tb_next if exctype is test . failureException : length = self . _count_relevant_tb_levels ( tb ) msgLines = traceback . format_exception ( exctype , value , tb , length ) else : msgLines = traceback . format_exception ( exctype , value , tb ) if self . buffer : output = self . _stdout_buffer . getvalue ( ) error = self . _stderr_buffer . 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 '' . join ( msgLines )
Converts a sys.exc_info()-style tuple of values into a string.