def __init__(self, err, test): """Create a TracebackContent for err.""" if err is None: raise ValueError("err may not be None") content_type = ContentType('text', 'x-traceback', {"language": "python", "charset": "utf8"}) self._result = TestResult() value = self._result._exc_info_to_unicode(err, test) super(TracebackContent, self).__init__( content_type, lambda: [value.encode("utf8")])
class TracebackContent(Content): """Content object for tracebacks. This adapts an exc_info tuple to the Content interface. text/x-traceback;language=python is used for the mime type, in order to provide room for other languages to format their tracebacks differently. """ def __init__(self, err, test): """Create a TracebackContent for err.""" if err is None: raise ValueError("err may not be None") content_type = ContentType('text', 'x-traceback', {"language": "python", "charset": "utf8"}) self._result = TestResult() value = self._result._exc_info_to_unicode(err, test) super(TracebackContent, self).__init__( content_type, lambda: [value.encode("utf8")])
def run(self, result=None): if result is None: result = TestResult() result.startTest(self) result.addError(self, self._error) result.stopTest(self)
def run(self, result=None): if result is None: result = TestResult() result.startTest(self) result.addSuccess(self) result.stopTest(self)
def _result(self, result): if result is None: return TestResult() else: return ExtendedToOriginalDecorator(result)
def defaultTestResult(self): return TestResult()