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