欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > python >内容正文

python

python summary结果提取_Python coverage.summary方法代码示例

发布时间:2023/12/19 python 33 豆豆
生活随笔 收集整理的这篇文章主要介绍了 python summary结果提取_Python coverage.summary方法代码示例 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

# 需要导入模块: from coverage import coverage [as 别名]

# 或者: from coverage.coverage import summary [as 别名]

def _harvest_data(self):

"""Get the collected data and reset the collector.

Also warn about various problems collecting data.

"""

if not self._measured:

return

self.data.add_line_data(self.collector.get_line_data())

self.data.add_arc_data(self.collector.get_arc_data())

self.collector.reset()

# If there are still entries in the source_pkgs list, then we never

# encountered those packages.

if self._warn_unimported_source:

for pkg in self.source_pkgs:

self._warn("Module %s was never imported." % pkg)

# Find out if we got any data.

summary = self.data.summary()

if not summary and self._warn_no_data:

self._warn("No data was collected.")

# Find files that were never executed at all.

for src in self.source:

for py_file in find_python_files(src):

py_file = self.file_locator.canonical_filename(py_file)

if self.omit_match and self.omit_match.match(py_file):

# Turns out this file was omitted, so don't pull it back

# in as unexecuted.

continue

self.data.touch_file(py_file)

self._measured = False

# Backward compatibility with version 1.

总结

以上是生活随笔为你收集整理的python summary结果提取_Python coverage.summary方法代码示例的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。