From b76e5fd7146b48947c0a9a41fc47899a0227c339 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 20 Jul 2015 07:00:04 -0400 Subject: Fix and test add_to_hash: test_data.py now 100% covers data.py --- coverage/data.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'coverage/data.py') 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. -- cgit v1.2.1