diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-03-28 06:38:02 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-03-28 06:38:02 -0400 |
commit | db04ffdd2c7305243728cd662c11d49714068b8f (patch) | |
tree | fc7e42edc2e350f1b62c8d7a21f10eaf88448671 | |
parent | b536b6c77c943eb95a0fe27705d842070027b407 (diff) | |
download | python-coveragepy-db04ffdd2c7305243728cd662c11d49714068b8f.tar.gz |
Clean up of the new plugin method. Thanks, Emil Madsen
-rw-r--r-- | CHANGES.rst | 3 | ||||
-rw-r--r-- | CONTRIBUTORS.txt | 1 | ||||
-rw-r--r-- | coverage/control.py | 3 | ||||
-rw-r--r-- | coverage/plugin.py | 8 |
4 files changed, 12 insertions, 3 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 6fca636..1f68bd7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,6 +16,9 @@ Unreleased also continue measurement. Both `issue 79`_ and `issue 448`_ described this problem, and have been fixed. +- Plugins can now find unexecuted files if they choose, by implementing the + `find_executable_files` method. Thanks, Emil Madsen. + - Minimal IronPython support. You should be able to run IronPython programs under ``coverage run``, though you will still have to do the reporting phase with CPython. diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 32e4140..2a7d606 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -39,6 +39,7 @@ Devin Jeanpierre Dmitry Shishov Dmitry Trofimov Eduardo Schettino +Emil Madsen Edward Loper Geoff Bache George Paci diff --git a/coverage/control.py b/coverage/control.py index 1f79e2f..4c43ee3 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -857,6 +857,7 @@ class Coverage(object): self.data.add_run_info(note=self.config.note) def _find_plugin_files(self, src_dir): + """Get executable files from the plugins.""" for plugin in self.plugins: for x_file in plugin.find_executable_files(src_dir): yield x_file, plugin._coverage_plugin_name @@ -868,7 +869,7 @@ class Coverage(object): and add them as unexecuted files in `self.data`. """ - py_files = ((py_file, None) for py_file in files.find_python_files(src_dir)) + py_files = ((py_file, None) for py_file in find_python_files(src_dir)) plugin_files = self._find_plugin_files(src_dir) for file_path, plugin_name in itertools.chain(py_files, plugin_files): diff --git a/coverage/plugin.py b/coverage/plugin.py index 43f291b..3e0e483 100644 --- a/coverage/plugin.py +++ b/coverage/plugin.py @@ -89,12 +89,16 @@ class CoveragePlugin(object): """ _needs_to_implement(self, "file_reporter") - def find_executable_files(self, src_dir): - """Yield all of the executable files in `dirname`, recursively. + def find_executable_files(self, src_dir): # pylint: disable=unused-argument + """Yield all of the executable files in `src_dir`, recursively. Executability is a plugin-specific property, but generally means files which would have been considered for coverage analysis, had they been included automatically. + + Returns or yields a sequence of strings, the paths to files that could + have been executed, including files that had been executed. + """ return [] |