diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-20 07:00:04 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-20 07:00:04 -0400 |
commit | b76e5fd7146b48947c0a9a41fc47899a0227c339 (patch) | |
tree | fbf6cc4b1abf45b1ac9a4651d34ab00e54e5fa3d /coverage/data.py | |
parent | b88c58b927eddb401f7e901025155b3302c3ae61 (diff) | |
download | python-coveragepy-git-b76e5fd7146b48947c0a9a41fc47899a0227c339.tar.gz |
Fix and test add_to_hash: test_data.py now 100% covers data.py
Diffstat (limited to 'coverage/data.py')
-rw-r--r-- | coverage/data.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/coverage/data.py b/coverage/data.py index f2e528d4..e5c37cb7 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -267,9 +267,19 @@ class CoverageData(object): return list(self._arcs or self._lines) def add_to_hash(self, filename, hasher): - """Contribute `filename`'s data to the Md5Hash `hasher`.""" - hasher.update(self.lines(filename)) - hasher.update(self.arcs(filename)) + """Contribute `filename`'s data to the `hasher`. + + Arguments: + filename (str): the filename we're interested in. + hasher (:class:`coverage.misc.Hasher`): the Hasher to update with + the file's data. + + """ + if self._arcs: + hasher.update(sorted(self.arcs(filename))) + else: + hasher.update(sorted(self.lines(filename))) + hasher.update(self.plugin_name(filename)) def line_counts(self, fullpath=False): """Return a dict summarizing the line coverage data. |