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


Python unittest._TextTestResult方法代码示例

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


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

示例1: addSuccess

# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import _TextTestResult [as 别名]
def addSuccess(self, test):
        super(TextTestResult, self).addSuccess(test)
        self._process(test, "ok") 
开发者ID:refack,项目名称:GYP3,代码行数:5,代码来源:taprunner.py

示例2: addFailure

# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import _TextTestResult [as 别名]
def addFailure(self, test, err):
        super(TextTestResult, self).addFailure(test, err)
        self._process(test, "not ok", "FAIL")
        # [ ] add structured data about assertion 
开发者ID:refack,项目名称:GYP3,代码行数:6,代码来源:taprunner.py

示例3: addError

# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import _TextTestResult [as 别名]
def addError(self, test, err):
        super(TextTestResult, self).addError(test, err)
        self._process(test, "not ok", "ERROR")
        # [ ] add structured data about exception 
开发者ID:refack,项目名称:GYP3,代码行数:6,代码来源:taprunner.py

示例4: addSkip

# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import _TextTestResult [as 别名]
def addSkip(self, test, reason):
        super(TextTestResult, self).addSkip(test, reason)
        self._process(test, "ok", directive=("  # SKIP  %s" % reason)) 
开发者ID:refack,项目名称:GYP3,代码行数:5,代码来源:taprunner.py

示例5: addExpectedFailure

# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import _TextTestResult [as 别名]
def addExpectedFailure(self, test, err):
        super(TextTestResult, self).addExpectedFailure(test, err)
        self._process(test, "not ok", directive=("  # TODO")) 
开发者ID:refack,项目名称:GYP3,代码行数:5,代码来源:taprunner.py

示例6: run_test_suite

# 需要导入模块: import unittest [as 别名]
# 或者: from unittest import _TextTestResult [as 别名]
def run_test_suite():
    def mark_failed():
        global failed
        failed = True

    class _TrackingTextTestResult(unittest._TextTestResult):
        def addError(self, test, err):
            unittest._TextTestResult.addError(self, test, err)
            mark_failed()

        def addFailure(self, test, err):
            unittest._TextTestResult.addFailure(self, test, err)
            mark_failed()

    class TrackingTextTestRunner(unittest.TextTestRunner):
        def _makeResult(self):
            return _TrackingTextTestResult(
                self.stream, self.descriptions, self.verbosity)

    load_env_file(os.path.abspath(os.getcwd()) + os.sep + "environment.env")
    original_cwd = os.path.abspath(os.getcwd())
    os.chdir('.%stests%s' % (os.sep, os.sep))
    suite = unittest.defaultTestLoader.discover('.', pattern="*.py")
    runner = TrackingTextTestRunner(verbosity=2)
    runner.run(suite)
    os.chdir(original_cwd)

    return failed 
开发者ID:DevoInc,项目名称:python-sdk,代码行数:30,代码来源:run_tests.py


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