From 26445508a2eb1c7ef459a33ec058eb3f3c5b41dd Mon Sep 17 00:00:00 2001 From: Felix Horvat Date: Thu, 17 Nov 2022 12:34:22 +0100 Subject: feat: added support for finding unexecuted namespace packages (#1387) * add support for namespace packages * fixed typo * update documentation * fixed lint issues * changed versionadded * convert to config setting * removed pure formatting changes * code review changes Co-authored-by: Ned Batchelder --- coverage/files.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'coverage/files.py') diff --git a/coverage/files.py b/coverage/files.py index bfd808ff..8be292f3 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -461,7 +461,7 @@ class PathAliases: return path -def find_python_files(dirname): +def find_python_files(dirname, include_namespace_packages): """Yield all of the importable Python files in `dirname`, recursively. To be importable, the files have to be in a directory with a __init__.py, @@ -472,7 +472,8 @@ def find_python_files(dirname): """ for i, (dirpath, dirnames, filenames) in enumerate(os.walk(dirname)): - if i > 0 and '__init__.py' not in filenames: + if (i > 0 and '__init__.py' not in filenames + and not include_namespace_packages): # If a directory doesn't have __init__.py, then it isn't # importable and neither are its files del dirnames[:] -- cgit v1.2.1