diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2013-04-21 23:13:58 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2013-04-21 23:13:58 -0400 |
commit | 1b09f2f466398691582173238fbb90c96e49641f (patch) | |
tree | aa3303099e39fc28de019b3e399f9d073193709c /coverage/control.py | |
parent | 25e2807b018d54a70b35e44261ab5a6265348d27 (diff) | |
download | python-coveragepy-git-1b09f2f466398691582173238fbb90c96e49641f.tar.gz |
I like it better like this.
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/coverage/control.py b/coverage/control.py index 09bd75fc..8821bfbb 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -479,35 +479,37 @@ class coverage(object): Also warn about various problems collecting data. """ - if self._measured: - self.data.add_line_data(self.collector.get_line_data()) - self.data.add_arc_data(self.collector.get_arc_data()) - self.collector.reset() - - # If there are still entries in the source_pkgs list, then we never - # encountered those packages. - if self._warn_unimported_source: - for pkg in self.source_pkgs: - self._warn("Module %s was never imported." % pkg) - - # Find out if we got any data. - summary = self.data.summary() - if not summary and self._warn_no_data: - self._warn("No data was collected.") - - # Find files that were never executed at all. - for src in self.source: - for py_file in find_python_files(src): - py_file = self.file_locator.canonical_filename(py_file) - - if self.omit_match and self.omit_match.match(py_file): - # Turns out this file was omitted, so don't pull it - # back in as unexecuted. - continue - - self.data.touch_file(py_file) - - self._measured = False + if not self._measured: + return + + self.data.add_line_data(self.collector.get_line_data()) + self.data.add_arc_data(self.collector.get_arc_data()) + self.collector.reset() + + # If there are still entries in the source_pkgs list, then we never + # encountered those packages. + if self._warn_unimported_source: + for pkg in self.source_pkgs: + self._warn("Module %s was never imported." % pkg) + + # Find out if we got any data. + summary = self.data.summary() + if not summary and self._warn_no_data: + self._warn("No data was collected.") + + # Find files that were never executed at all. + for src in self.source: + for py_file in find_python_files(src): + py_file = self.file_locator.canonical_filename(py_file) + + if self.omit_match and self.omit_match.match(py_file): + # Turns out this file was omitted, so don't pull it back + # in as unexecuted. + continue + + self.data.touch_file(py_file) + + self._measured = False # Backward compatibility with version 1. def analysis(self, morf): |