summaryrefslogtreecommitdiff
path: root/coverage/files.py
diff options
context:
space:
mode:
authorFelix Horvat <felix.horvat@ocell.io>2022-11-17 12:34:22 +0100
committerGitHub <noreply@github.com>2022-11-17 03:34:22 -0800
commit26445508a2eb1c7ef459a33ec058eb3f3c5b41dd (patch)
treede2e539150ae838b813a889583e510642989c7b4 /coverage/files.py
parente76b5c7e0117f885f89190de9e07c1d2410ba58b (diff)
downloadpython-coveragepy-git-26445508a2eb1c7ef459a33ec058eb3f3c5b41dd.tar.gz
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 <ned@nedbatchelder.com>
Diffstat (limited to 'coverage/files.py')
-rw-r--r--coverage/files.py5
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[:]