本文整理汇总了Python中collector.Collector.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Collector.reset方法的具体用法?Python Collector.reset怎么用?Python Collector.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collector.Collector
的用法示例。
在下文中一共展示了Collector.reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: coverage
# 需要导入模块: from collector import Collector [as 别名]
# 或者: from collector.Collector import reset [as 别名]
#.........这里部分代码省略.........
# co_filename value.
dunder_file = frame.f_globals.get('__file__')
if dunder_file:
if not dunder_file.endswith(".py"):
if dunder_file[-4:-1] == ".py":
dunder_file = dunder_file[:-1]
filename = dunder_file
canonical = self.file_locator.canonical_filename(filename)
# If we aren't supposed to trace installed code, then check if this is
# near the Python standard library and skip it if so.
if not self.cover_pylib:
if canonical.startswith(self.pylib_prefix):
return False
# We exclude the coverage code itself, since a little of it will be
# measured otherwise.
if canonical.startswith(self.cover_prefix):
return False
return canonical
def use_cache(self, usecache):
"""Control the use of a data file (incorrectly called a cache).
`usecache` is true or false, whether to read and write data on disk.
"""
self.data.usefile(usecache)
def load(self):
"""Load previously-collected coverage data from the data file."""
self.collector.reset()
self.data.read()
def start(self):
"""Start measuring code coverage."""
if self.auto_data:
self.load()
# Save coverage data when Python exits.
import atexit
atexit.register(self.save)
self.collector.start()
def stop(self):
"""Stop measuring code coverage."""
self.collector.stop()
self._harvest_data()
def erase(self):
"""Erase previously-collected coverage data.
This removes the in-memory data collected in this session as well as
discarding the data file.
"""
self.collector.reset()
self.data.erase()
def clear_exclude(self):
"""Clear the exclude list."""
self.exclude_list = []
self.exclude_re = ""
def exclude(self, regex):