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


Python Coverage.xml_report方法代码示例

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


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

示例1: run_tests

# 需要导入模块: from coverage import Coverage [as 别名]
# 或者: from coverage.Coverage import xml_report [as 别名]
    def run_tests(self):
        from illume import config
        from coverage import Coverage

        config.setenv("test")

        from pytest import main
        from illume.util import remove_or_ignore_dir
        from logging import basicConfig, DEBUG

        basicConfig(level=DEBUG, filename="illume-test.log")

        project_root = config.get("PROJECT_ROOT")
        data_dir = config.get("DATA_DIR")
        cov_config_dir = os.path.join(project_root, '.coveagerc')

        cov = Coverage(config_file=cov_config_dir)
        # Remvoe data directory in case tests failed to complete last time.
        remove_or_ignore_dir(data_dir)
        cov.start()

        exit_code = main(shlex.split(self.pytest_args or ""))

        cov.stop()
        cov.xml_report()

        # Remove data directory if tests passed successfully. Keep it around
        # if tests failed so the developer can troubleshoot the problem.
        if exit_code == 0:
            remove_or_ignore_dir(data_dir)

        sys.exit(exit_code)
开发者ID:iakinsey,项目名称:illume,代码行数:34,代码来源:setup.py

示例2: run

# 需要导入模块: from coverage import Coverage [as 别名]
# 或者: from coverage.Coverage import xml_report [as 别名]
    def run(self):
        from coverage import Coverage

        cov = Coverage(source=self.distribution.packages)
        cov.start()

        super().run()

        cov.stop()
        cov.xml_report()
        cov.html_report()
开发者ID:mcrute,项目名称:pydora,代码行数:13,代码来源:setup.py

示例3: Coverage

# 需要导入模块: from coverage import Coverage [as 别名]
# 或者: from coverage.Coverage import xml_report [as 别名]
# usage:
#   run_tests.py [PYTEST_ARGS]

import os
import subprocess
import sys

from coverage import Coverage


SHELL = sys.platform == 'win32'


if __name__ == '__main__':
    command = ['py.test']
    if os.environ.get('WITH_COVERAGE') == '1':
        command.extend(['--cov=rinoh', '--cov-report='])
    if os.environ.get('BASETEMP'):
        command.append('--basetemp={}'.format(os.environ['BASETEMP']))
    command.extend(sys.argv[1:])
    rc = subprocess.call(command, shell=SHELL)
    if os.environ.get('WITH_COVERAGE') == '1':
        cov = Coverage()
        cov.load()
        cov.combine()
        cov.report(skip_covered=True)
        cov.xml_report()
    raise SystemExit(rc)
开发者ID:brechtm,项目名称:rinohtype,代码行数:30,代码来源:run_tests.py

示例4: CoverageScript

# 需要导入模块: from coverage import Coverage [as 别名]
# 或者: from coverage.Coverage import xml_report [as 别名]

#.........这里部分代码省略.........

        # Remaining actions are reporting, with some common options.
        report_args = dict(
            morfs=unglob_args(args),
            ignore_errors=options.ignore_errors,
            omit=omit,
            include=include,
            )

        # We need to be able to import from the current directory, because
        # plugins may try to, for example, to read Django settings.
        sys.path.insert(0, '')

        self.coverage.load()

        total = None
        if options.action == "report":
            total = self.coverage.report(
                show_missing=options.show_missing,
                skip_covered=options.skip_covered,
                **report_args
                )
        elif options.action == "annotate":
            self.coverage.annotate(directory=options.directory, **report_args)
        elif options.action == "html":
            total = self.coverage.html_report(
                directory=options.directory,
                title=options.title,
                skip_covered=options.skip_covered,
                **report_args
                )
        elif options.action == "xml":
            outfile = options.outfile
            total = self.coverage.xml_report(outfile=outfile, **report_args)

        if total is not None:
            # Apply the command line fail-under options, and then use the config
            # value, so we can get fail_under from the config file.
            if options.fail_under is not None:
                self.coverage.set_option("report:fail_under", options.fail_under)

            fail_under = self.coverage.get_option("report:fail_under")
            precision = self.coverage.get_option("report:precision")
            if should_fail_under(total, fail_under, precision):
                return FAIL_UNDER

        return OK

    def do_help(self, options, args, parser):
        """Deal with help requests.

        Return True if it handled the request, False if not.

        """
        # Handle help.
        if options.help:
            if self.global_option:
                show_help(topic='help')
            else:
                show_help(parser=parser)
            return True

        if options.action == "help":
            if args:
                for a in args:
                    parser = CMDS.get(a)
开发者ID:hugovk,项目名称:coveragepy,代码行数:70,代码来源:cmdline.py


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