当前位置: 首页>>代码示例>>Python>>正文


Python TestResult._exc_info_to_string方法代码示例

本文整理汇总了Python中unittest.TestResult._exc_info_to_string方法的典型用法代码示例。如果您正苦于以下问题:Python TestResult._exc_info_to_string方法的具体用法?Python TestResult._exc_info_to_string怎么用?Python TestResult._exc_info_to_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unittest.TestResult的用法示例。


在下文中一共展示了TestResult._exc_info_to_string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: addFailure

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import _exc_info_to_string [as 别名]
 def addFailure(self, test, err):
     TestResult.addFailure(self,test, err)
     file_name =  getattr(self.stream,"name")
     if self.showAll:
         self.stream.writeln("FAIL")
     elif self.dots:
         self.stream.write('F')
     failure = TestResult._exc_info_to_string(self,err,test)
     log.result("#" * 50)
     log.result("%s: FAIL" % test._testMethodName)
     print "%s: FAIL" % test._testMethodName
     log.result("#" * 50)
     if "stdout" not in file_name:
             log.result("\n\n%s"%failure)
开发者ID:muttu2244,项目名称:MyPython,代码行数:16,代码来源:StokeTest.py

示例2: addError

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import _exc_info_to_string [as 别名]
 def addError(self, test, err):
     TestResult.addError(self,test, err)
     file_name =  getattr(self.stream,"name")
     if self.showAll:
         self.stream.writeln("ERROR")
     elif self.dots:
         self.stream.write('E')
     error = TestResult._exc_info_to_string(self,err,test)
     log.error("#" * 50)
     log.error("%s errored out." % test._testMethodName)
     if "setUp" in test._testMethodName:
         print "Testsuite  aborted in setUp itself."
     log.error("#" * 50)
     if "stdout" not in file_name:
             log.error("\n\n%s"%error)
开发者ID:muttu2244,项目名称:MyPython,代码行数:17,代码来源:StokeTest.py

示例3: TracebackContent

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import _exc_info_to_string [as 别名]
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_string(err, test)
        super(TracebackContent, self).__init__(
            content_type, lambda: [value.encode("utf8")])
开发者ID:endisd,项目名称:samba,代码行数:20,代码来源:content.py

示例4: _exc_info_to_string

# 需要导入模块: from unittest import TestResult [as 别名]
# 或者: from unittest.TestResult import _exc_info_to_string [as 别名]
 def _exc_info_to_string(self, err, test):
     # Includes second argument as of Unittest version 1.63 rev. 34859
     if unittest_version < (1,63):
         return TestResult._exc_info_to_string(self, err)
     else:
         return TestResult._exc_info_to_string(self, err, test)
开发者ID:eojons,项目名称:gpaw-scme,代码行数:8,代码来源:parunittest.py


注:本文中的unittest.TestResult._exc_info_to_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。