当前位置: 首页>>代码示例>>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;未经允许,请勿转载。