diff options
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 5 |
1 files changed, 3 insertions, 2 deletions
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[:] |