diff options
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | coverage/control.py | 9 | ||||
-rw-r--r-- | coverage/data.py | 25 | ||||
-rw-r--r-- | doc/api.rst | 1 |
4 files changed, 13 insertions, 24 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 136300fb..273f2c52 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -16,6 +16,8 @@ Latest - Code that was executed with `exec` would be mis-attributed to the file that called it. This is now fixed, closing `issue 380`_. +- The ``use_cache`` method is no longer supported. + .. 41 issues closed in 4.0 so far .. _issue 380: https://bitbucket.org/ned/coveragepy/issues/380/code-executed-by-exec-excluded-from diff --git a/coverage/control.py b/coverage/control.py index 91365e11..7fc11700 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -601,13 +601,10 @@ class Coverage(object): sys.stderr.write("Coverage.py warning: %s\n" % msg) 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. - - """ + """Obsolete method.""" self._init() - self.data.usefile(usecache) + if not usecache: + self._warn("use_cache(False) is no longer supported.") def load(self): """Load previously-collected coverage data from the data file.""" diff --git a/coverage/data.py b/coverage/data.py index a1ce582c..69e928e2 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -40,8 +40,6 @@ class CoverageData(object): self.collector = collector or 'unknown' self.debug = debug - self.use_file = True - # Construct the filename that will be used for data file storage, if we # ever do any file storage. self.filename = basename or ".coverage" @@ -76,16 +74,9 @@ class CoverageData(object): # } self.plugins = {} - def usefile(self, use_file=True): - """Set whether or not to use a disk file for data.""" - self.use_file = use_file - def read(self): """Read coverage data from the coverage data file (if it exists).""" - if self.use_file: - self.lines, self.arcs, self.plugins = self._read_file(self.filename) - else: - self.lines, self.arcs, self.plugins = {}, {}, {} + self.lines, self.arcs, self.plugins = self._read_file(self.filename) def write(self, suffix=None): """Write the collected coverage data to a file. @@ -96,17 +87,15 @@ class CoverageData(object): the suffix. """ - if self.use_file: - filename = self.filename - if suffix: - filename += "." + suffix - self.write_file(filename) + filename = self.filename + if suffix: + filename += "." + suffix + self.write_file(filename) def erase(self): """Erase the data, both in this object, and from its file storage.""" - if self.use_file: - if self.filename: - file_be_gone(self.filename) + if self.filename: + file_be_gone(self.filename) self.lines = {} self.arcs = {} self.plugins = {} diff --git a/doc/api.rst b/doc/api.rst index 815b75e0..7c6dda35 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -37,6 +37,7 @@ The coverage module .. autoclass:: Coverage :members: + :exclude-members: use_cache Starting coverage automatically |