本文整理匯總了Python中coverage.Coverage.annotate方法的典型用法代碼示例。如果您正苦於以下問題:Python Coverage.annotate方法的具體用法?Python Coverage.annotate怎麽用?Python Coverage.annotate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類coverage.Coverage
的用法示例。
在下文中一共展示了Coverage.annotate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: CoverageScript
# 需要導入模塊: from coverage import Coverage [as 別名]
# 或者: from coverage.Coverage import annotate [as 別名]
#.........這裏部分代碼省略.........
elif options.action == "run":
return self.do_run(options, args)
elif options.action == "combine":
if options.append:
self.coverage.load()
data_dirs = args or None
self.coverage.combine(data_dirs, strict=True)
self.coverage.save()
return OK
# 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.