summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/control.py5
-rw-r--r--coverage/inorout.py19
2 files changed, 14 insertions, 10 deletions
diff --git a/coverage/control.py b/coverage/control.py
index c342eca4..6830afba 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -665,9 +665,10 @@ class Coverage(object):
if not self._data and self._warn_no_data:
self._warn("No data was collected.", slug="no-data-collected")
- # Find files that were never executed at all.
+ # Touch all the files that could have executed, so that we can
+ # mark completely unexecuted files as 0% covered.
if self._data:
- for file_path, plugin_name in self._inorout.find_unexecuted_files():
+ for file_path, plugin_name in self._inorout.find_possibly_unexecuted_files():
self._data.touch_file(file_path, plugin_name)
if self.config.note:
diff --git a/coverage/inorout.py b/coverage/inorout.py
index c31e9206..2a19ba69 100644
--- a/coverage/inorout.py
+++ b/coverage/inorout.py
@@ -395,8 +395,8 @@ class InOrOut(object):
slug="module-not-measured",
)
- def find_unexecuted_files(self):
- """Find files in the areas of interest that weren't traced.
+ def find_possibly_unexecuted_files(self):
+ """Find files in the areas of interest that might be untraced.
Yields pairs: file path, and responsible plug-in name.
"""
@@ -405,11 +405,11 @@ class InOrOut(object):
not module_has_file(sys.modules[pkg])):
continue
pkg_file = source_for_file(sys.modules[pkg].__file__)
- for ret in self._find_unexecuted_files(canonical_path(pkg_file)):
+ for ret in self._find_executable_files(canonical_path(pkg_file)):
yield ret
for src in self.source:
- for ret in self._find_unexecuted_files(src):
+ for ret in self._find_executable_files(src):
yield ret
def _find_plugin_files(self, src_dir):
@@ -418,11 +418,14 @@ class InOrOut(object):
for x_file in plugin.find_executable_files(src_dir):
yield x_file, plugin._coverage_plugin_name
- def _find_unexecuted_files(self, src_dir):
- """Find unexecuted files in `src_dir`.
+ def _find_executable_files(self, src_dir):
+ """Find executable files in `src_dir`.
- Search for files in `src_dir` that are probably importable,
- and add them as unexecuted files in `self.data`.
+ Search for files in `src_dir` that can be executed because they
+ are probably importable. Don't include ones that have been omitted
+ by the configuration.
+
+ Yield the file path, and the plugin name that handles the file.
"""
py_files = ((py_file, None) for py_file in find_python_files(src_dir))