本文整理匯總了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):