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


Python Collector.flush_data方法代码示例

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


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

示例1: Coverage

# 需要导入模块: from coverage.collector import Collector [as 别名]
# 或者: from coverage.collector.Collector import flush_data [as 别名]

#.........这里部分代码省略.........
        .. versionadded:: 4.3
            The `strict` parameter.

        """
        self._init()
        self._init_data(suffix=None)
        self._post_init()
        self.get_data()

        aliases = None
        if self.config.paths:
            aliases = PathAliases()
            for paths in self.config.paths.values():
                result = paths[0]
                for pattern in paths[1:]:
                    aliases.add(pattern, result)

        combine_parallel_data(self._data, aliases=aliases, data_paths=data_paths, strict=strict)

    def get_data(self):
        """Get the collected data.

        Also warn about various problems collecting data.

        Returns a :class:`coverage.CoverageData`, the collected coverage data.

        .. versionadded:: 4.0

        """
        self._init()
        self._init_data(suffix=None)
        self._post_init()

        if self._collector and self._collector.flush_data():
            self._post_save_work()

        return self._data

    def _post_save_work(self):
        """After saving data, look for warnings, post-work, etc.

        Warn about things that should have happened but didn't.
        Look for unexecuted files.

        """
        # If there are still entries in the source_pkgs_unmatched list,
        # then we never encountered those packages.
        if self._warn_unimported_source:
            self._inorout.warn_unimported_source()

        # Find out if we got any data.
        if not self._data and self._warn_no_data:
            self._warn("No data was collected.", slug="no-data-collected")

        # Find files that were never executed at all.
        for file_path, plugin_name in self._inorout.find_unexecuted_files():
            self._data.touch_file(file_path, plugin_name)

        if self.config.note:
            self._data.add_run_info(note=self.config.note)

    # Backward compatibility with version 1.
    def analysis(self, morf):
        """Like `analysis2` but doesn't return excluded line numbers."""
        f, s, _, m, mf = self.analysis2(morf)
        return f, s, m, mf
开发者ID:hugovk,项目名称:coveragepy,代码行数:70,代码来源:control.py


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