summaryrefslogtreecommitdiff
path: root/tests/test_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 /tests/test_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 'tests/test_files.py')
-rw-r--r--tests/test_files.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_files.py b/tests/test_files.py
index 561b961d..a69d1a4b 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -585,13 +585,30 @@ class FindPythonFilesTest(CoverageTest):
self.make_file("sub/ssub/~s.py") # nope: editor effluvia
self.make_file("sub/lab/exp.py") # nope: no __init__.py
self.make_file("sub/windows.pyw")
- py_files = set(find_python_files("sub"))
+ py_files = set(find_python_files("sub", include_namespace_packages=False))
self.assert_same_files(py_files, [
"sub/a.py", "sub/b.py",
"sub/ssub/__init__.py", "sub/ssub/s.py",
"sub/windows.pyw",
])
+ def test_find_python_files_include_namespace_packages(self):
+ self.make_file("sub/a.py")
+ self.make_file("sub/b.py")
+ self.make_file("sub/x.c") # nope: not .py
+ self.make_file("sub/ssub/__init__.py")
+ self.make_file("sub/ssub/s.py")
+ self.make_file("sub/ssub/~s.py") # nope: editor effluvia
+ self.make_file("sub/lab/exp.py")
+ self.make_file("sub/windows.pyw")
+ py_files = set(find_python_files("sub", include_namespace_packages=True))
+ self.assert_same_files(py_files, [
+ "sub/a.py", "sub/b.py",
+ "sub/ssub/__init__.py", "sub/ssub/s.py",
+ "sub/lab/exp.py",
+ "sub/windows.pyw",
+ ])
+
@pytest.mark.skipif(not env.WINDOWS, reason="Only need to run Windows tests on Windows.")
class WindowsFileTest(CoverageTest):