本文整理汇总了Python中coverage.collector.Collector.use_data方法的典型用法代码示例。如果您正苦于以下问题:Python Collector.use_data方法的具体用法?Python Collector.use_data怎么用?Python Collector.use_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coverage.collector.Collector
的用法示例。
在下文中一共展示了Collector.use_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Coverage
# 需要导入模块: from coverage.collector import Collector [as 别名]
# 或者: from coverage.collector.Collector import use_data [as 别名]
#.........这里部分代码省略.........
elif self.config.dynamic_context == "test_function":
context_switchers = [should_start_context_test_function]
else:
raise CoverageException(
"Don't understand dynamic_context setting: {!r}".format(self.config.dynamic_context)
)
context_switchers.extend(
plugin.dynamic_context for plugin in self._plugins.context_switchers
)
should_start_context = combine_context_switchers(context_switchers)
self._collector = Collector(
should_trace=self._should_trace,
check_include=self._check_include_omit_etc,
should_start_context=should_start_context,
timid=self.config.timid,
branch=self.config.branch,
warn=self._warn,
concurrency=concurrency,
)
suffix = self._data_suffix_specified
if suffix or self.config.parallel:
if not isinstance(suffix, string_class):
# if data_suffix=True, use .machinename.pid.random
suffix = True
else:
suffix = None
self._init_data(suffix)
self._collector.use_data(self._data, self.config.context)
# Early warning if we aren't going to be able to support plugins.
if self._plugins.file_tracers and not self._collector.supports_plugins:
self._warn(
"Plugin file tracers (%s) aren't supported with %s" % (
", ".join(
plugin._coverage_plugin_name
for plugin in self._plugins.file_tracers
),
self._collector.tracer_name(),
)
)
for plugin in self._plugins.file_tracers:
plugin._coverage_enabled = False
# Create the file classifying substructure.
self._inorout = self._inorout_class(warn=self._warn)
self._inorout.configure(self.config)
self._inorout.plugins = self._plugins
self._inorout.disp_class = self._collector.file_disposition_class
atexit.register(self._atexit)
def _init_data(self, suffix):
"""Create a data file if we don't have one yet."""
if self._data is None:
# Create the data file. We do this at construction time so that the
# data file will be written into the directory where the process
# started rather than wherever the process eventually chdir'd to.
ensure_dir_for_file(self.config.data_file)
self._data = CoverageData(
basename=self.config.data_file,