diff options
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rw-r--r-- | coverage/data.py | 18 | ||||
-rw-r--r-- | coverage/pickle2json.py | 2 | ||||
-rw-r--r-- | tests/test_data.py | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index cfb9a999..0157abf8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -18,8 +18,8 @@ Latest message. This is now fixed, and changed some method names in the CoverageData interface. Fixes `issue 399`_. -- `CoverageData.read` and `CoverageData.write` are now properly inverses of - each other. +- `CoverageData.read_fileobj` and `CoverageData.write_fileobj` replace the + `.read` and `.write` methods, and are now properly inverses of each other. - When using ``report --skip-covered``, a message will now be included in the report output indicating how many files were skipped, and if all files are diff --git a/coverage/data.py b/coverage/data.py index c319e65a..9a636358 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -52,10 +52,10 @@ class CoverageData(object): names in this API are case-sensitive, even on platforms with case-insensitive file systems. - To read a coverage.py data file, use :meth:`read_file`, or :meth:`read` - if you have an already-opened file. You can then access the line, arc, or - file tracer data with :meth:`lines`, :meth:`arcs`, or - :meth:`file_tracer`. Run information is available with + To read a coverage.py data file, use :meth:`read_file`, or + :meth:`read_fileobj` if you have an already-opened file. You can then + access the line, arc, or file tracer data with :meth:`lines`, :meth:`arcs`, + or :meth:`file_tracer`. Run information is available with :meth:`run_infos`. The :meth:`has_arcs` method indicates whether arc data is available. You @@ -74,7 +74,7 @@ class CoverageData(object): To add a file without any measured data, use :meth:`touch_file`. You write to a named file with :meth:`write_file`, or to an already opened - file with :meth:`write`. + file with :meth:`write_fileobj`. You can clear the data in memory with :meth:`erase`. Two data collections can be combined by using :meth:`update` on one :class:`CoverageData`, @@ -256,7 +256,7 @@ class CoverageData(object): __bool__ = __nonzero__ - def read(self, file_obj): + def read_fileobj(self, file_obj): """Read the coverage data from the given file object. Should only be used on an empty CoverageData object. @@ -284,7 +284,7 @@ class CoverageData(object): self._debug.write("Reading data from %r" % (filename,)) try: with self._open_for_reading(filename) as f: - self.read(f) + self.read_fileobj(f) except Exception as exc: raise CoverageException( "Couldn't read data from '%s': %s: %s" % ( @@ -425,7 +425,7 @@ class CoverageData(object): self._validate() - def write(self, file_obj): + def write_fileobj(self, file_obj): """Write the coverage data to `file_obj`.""" # Create the file data. @@ -452,7 +452,7 @@ class CoverageData(object): if self._debug and self._debug.should('dataio'): self._debug.write("Writing data to %r" % (filename,)) with open(filename, 'w') as fdata: - self.write(fdata) + self.write_fileobj(fdata) def erase(self): """Erase the data in this object.""" diff --git a/coverage/pickle2json.py b/coverage/pickle2json.py index 3d7fc6aa..95b42ef3 100644 --- a/coverage/pickle2json.py +++ b/coverage/pickle2json.py @@ -21,7 +21,7 @@ def pickle2json(infile, outfile): covdata = CoverageData() with open(infile, 'rb') as inf: - covdata.read(inf) + covdata.read_fileobj(inf) covdata.write_file(outfile) finally: diff --git a/tests/test_data.py b/tests/test_data.py index ea6b0df0..ec3a6786 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -397,11 +397,11 @@ class CoverageDataTest(DataTestHelpers, CoverageTest): covdata1 = CoverageData() covdata1.add_arcs(ARCS_3) stringio = StringIO() - covdata1.write(stringio) + covdata1.write_fileobj(stringio) stringio.seek(0) covdata2 = CoverageData() - covdata2.read(stringio) + covdata2.read_fileobj(stringio) self.assert_arcs3_data(covdata2) |