當前位置: 首頁>>代碼示例>>Python>>正文


Python runner.TextTestRunner方法代碼示例

本文整理匯總了Python中unittest.runner.TextTestRunner方法的典型用法代碼示例。如果您正苦於以下問題:Python runner.TextTestRunner方法的具體用法?Python runner.TextTestRunner怎麽用?Python runner.TextTestRunner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在unittest.runner的用法示例。


在下文中一共展示了runner.TextTestRunner方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _run_inner

# 需要導入模塊: from unittest import runner [as 別名]
# 或者: from unittest.runner import TextTestRunner [as 別名]
def _run_inner(self, result):
        # We hijack TextTestRunner.run()'s inner logic by passing this
        # method as if it were a test case.
        child_runner = _MinimalRunner(self.runner_cls, self.runner_args)
        pool = multiprocessing.Pool()
        imap = pool.imap_unordered
        try:
            for child_result in imap(child_runner, self._test_list):
                result.add_results(child_result)
                if child_result.shouldStop:
                    break
            return result
        finally:
            # Kill the still active workers
            pool.terminate()
            pool.join() 
開發者ID:numba,項目名稱:llvmlite,代碼行數:18,代碼來源:customize.py

示例2: runTests

# 需要導入模塊: from unittest import runner [as 別名]
# 或者: from unittest.runner import TextTestRunner [as 別名]
def runTests(self):
        if self.refleak:
            self.testRunner = RefleakTestRunner

            if not hasattr(sys, "gettotalrefcount"):
                warnings.warn("detecting reference leaks requires a debug "
                              "build of Python, only memory leaks will be "
                              "detected")

        elif self.testRunner is None:
            self.testRunner = unittest.TextTestRunner

        if self.multiprocess:
            self.testRunner = ParallelTestRunner(self.testRunner,
                                                 verbosity=self.verbosity,
                                                 failfast=self.failfast,
                                                 buffer=self.buffer)

        def run_tests_real():
            super(NumbaTestProgram, self).runTests()

        if self.profile:
            filename = os.path.splitext(
                os.path.basename(sys.modules['__main__'].__file__)
            )[0] + '.prof'
            p = cProfile.Profile(timer=time.perf_counter)  # 3.3+
            p.enable()
            try:
                p.runcall(run_tests_real)
            finally:
                p.disable()
                print("Writing test profile data into %r" % (filename,))
                p.dump_stats(filename)
        else:
            run_tests_real()


# Monkey-patch unittest so that individual test modules get our custom
# options for free. 
開發者ID:numba,項目名稱:llvmlite,代碼行數:41,代碼來源:customize.py

示例3: __init__

# 需要導入模塊: from unittest import runner [as 別名]
# 或者: from unittest.runner import TextTestRunner [as 別名]
def __init__(self, runner_cls, **kwargs):
        runner.TextTestRunner.__init__(self, **kwargs)
        self.runner_cls = runner_cls
        self.runner_args = kwargs 
開發者ID:numba,項目名稱:llvmlite,代碼行數:6,代碼來源:customize.py


注:本文中的unittest.runner.TextTestRunner方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。