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


Python coverage.process_startup方法代码示例

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


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

示例1: add_coverage

# 需要导入模块: from coverage import coverage [as 别名]
# 或者: from coverage.coverage import process_startup [as 别名]
def add_coverage(self):
        try:
            sources = test_sections[self.section].includes
        except KeyError:
            sources = ['IPython']

        coverage_rc = ("[run]\n"
                       "data_file = {data_file}\n"
                       "source =\n"
                       "  {source}\n"
                      ).format(data_file=os.path.abspath('.coverage.'+self.section),
                               source="\n  ".join(sources))
        config_file = os.path.join(self.workingdir.name, '.coveragerc')
        with open(config_file, 'w') as f:
            f.write(coverage_rc)

        self.env['COVERAGE_PROCESS_START'] = config_file
        self.pycmd = "import coverage; coverage.process_startup(); " + self.pycmd 
开发者ID:thomasyimgit,项目名称:leetcode,代码行数:20,代码来源:iptestcontroller.py

示例2: process_startup

# 需要导入模块: from coverage import coverage [as 别名]
# 或者: from coverage.coverage import process_startup [as 别名]
def process_startup():
    """Call this at Python startup to perhaps measure coverage.

    If the environment variable COVERAGE_PROCESS_START is defined, coverage
    measurement is started.  The value of the variable is the config file
    to use.

    There are two ways to configure your Python installation to invoke this
    function when Python starts:

    #. Create or append to sitecustomize.py to add these lines::

        import coverage
        coverage.process_startup()

    #. Create a .pth file in your Python installation containing::

        import coverage; coverage.process_startup()

    """
    cps = os.environ.get("COVERAGE_PROCESS_START")
    if cps:
        cov = coverage(config_file=cps, auto_data=True)
        cov.start()
        cov._warn_no_data = False
        cov._warn_unimported_source = False


# A hack for debugging testing in subprocesses. 
开发者ID:RoseOu,项目名称:flasky,代码行数:31,代码来源:control.py


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