diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-07-07 07:40:24 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-07-07 13:39:13 -0400 |
commit | dade9db58673d4f712ba5c50ed66d1c67a7e1d5d (patch) | |
tree | 1b88b3f99bd3348b566d01943439ccb72b4673ca /coverage/control.py | |
parent | 4b43eff1377e818db2c42521d98bf2a0973b1cb6 (diff) | |
download | python-coveragepy-git-dade9db58673d4f712ba5c50ed66d1c67a7e1d5d.tar.gz |
Avoid useless or redundant db operations. Faster.
Moving operations into the "with self._connect" means less opening and
closing of the database. Returning early if there is no data to write
avoids writing empty contexts.
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/coverage/control.py b/coverage/control.py index a4e21295..1001a8d6 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -648,8 +648,9 @@ class Coverage(object): self._warn("No data was collected.", slug="no-data-collected") # Find files that were never executed at all. - for file_path, plugin_name in self._inorout.find_unexecuted_files(): - self._data.touch_file(file_path, plugin_name) + if self._data: + for file_path, plugin_name in self._inorout.find_unexecuted_files(): + self._data.touch_file(file_path, plugin_name) if self.config.note: self._data.add_run_info(note=self.config.note) |