本文整理汇总了Python中coverage.config.CoverageConfig.get_option方法的典型用法代码示例。如果您正苦于以下问题:Python CoverageConfig.get_option方法的具体用法?Python CoverageConfig.get_option怎么用?Python CoverageConfig.get_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coverage.config.CoverageConfig
的用法示例。
在下文中一共展示了CoverageConfig.get_option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CoverageReportingFake
# 需要导入模块: from coverage.config import CoverageConfig [as 别名]
# 或者: from coverage.config.CoverageConfig import get_option [as 别名]
class CoverageReportingFake(object):
"""A fake Coverage.coverage test double."""
# pylint: disable=missing-docstring
def __init__(self, report_result, html_result, xml_result):
self.config = CoverageConfig()
self.report_result = report_result
self.html_result = html_result
self.xml_result = xml_result
def set_option(self, optname, optvalue):
self.config.set_option(optname, optvalue)
def get_option(self, optname):
return self.config.get_option(optname)
def load(self):
pass
def report(self, *args_unused, **kwargs_unused):
return self.report_result
def html_report(self, *args_unused, **kwargs_unused):
return self.html_result
def xml_report(self, *args_unused, **kwargs_unused):
return self.xml_result
示例2: Coverage
# 需要导入模块: from coverage.config import CoverageConfig [as 别名]
# 或者: from coverage.config.CoverageConfig import get_option [as 别名]
#.........这里部分代码省略.........
"""Decide whether to trace execution in `filename`.
Calls `_should_trace_internal`, and returns the FileDisposition.
"""
disp = self._should_trace_internal(filename, frame)
if self.debug.should('trace'):
self.debug.write(_disposition_debug_msg(disp))
return disp
def _check_include_omit_etc(self, filename, frame):
"""Check a file name against the include/omit/etc, rules, verbosely.
Returns a boolean: True if the file should be traced, False if not.
"""
reason = self._check_include_omit_etc_internal(filename, frame)
if self.debug.should('trace'):
if not reason:
msg = "Including %r" % (filename,)
else:
msg = "Not including %r: %s" % (filename, reason)
self.debug.write(msg)
return not reason
def _warn(self, msg):
"""Use `msg` as a warning."""
self._warnings.append(msg)
if self.debug.should('pid'):
msg = "[%d] %s" % (os.getpid(), msg)
sys.stderr.write("Coverage.py warning: %s\n" % msg)
def get_option(self, option_name):
"""Get an option from the configuration.
`option_name` is a colon-separated string indicating the section and
option name. For example, the ``branch`` option in the ``[run]``
section of the config file would be indicated with `"run:branch"`.
Returns the value of the option.
.. versionadded:: 4.0
"""
return self.config.get_option(option_name)
def set_option(self, option_name, value):
"""Set an option in the configuration.
`option_name` is a colon-separated string indicating the section and
option name. For example, the ``branch`` option in the ``[run]``
section of the config file would be indicated with ``"run:branch"``.
`value` is the new value for the option. This should be a Python
value where appropriate. For example, use True for booleans, not the
string ``"True"``.
As an example, calling::
cov.set_option("run:branch", True)
has the same effect as this configuration file::
[run]
branch = True