當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。