diff options
| author | Felix Horvat <felix.horvat@ocell.io> | 2022-11-17 12:34:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-17 03:34:22 -0800 |
| commit | 26445508a2eb1c7ef459a33ec058eb3f3c5b41dd (patch) | |
| tree | de2e539150ae838b813a889583e510642989c7b4 /tests | |
| parent | e76b5c7e0117f885f89190de9e07c1d2410ba58b (diff) | |
| download | python-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')
| -rw-r--r-- | tests/test_config.py | 3 | ||||
| -rw-r--r-- | tests/test_files.py | 19 |
2 files changed, 21 insertions, 1 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 444719fd..5f8a0547 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -494,6 +494,8 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): skip_covered = TruE skip_empty =TruE + include_namespace_packages = TRUE + [{section}html] directory = c:\\tricky\\dir.somewhere @@ -589,6 +591,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): assert cov.config.get_plugin_options("plugins.another") == {} assert cov.config.json_show_contexts is True assert cov.config.json_pretty_print is True + assert cov.config.include_namespace_packages is True def test_config_file_settings(self): self.make_file(".coveragerc", self.LOTSA_SETTINGS.format(section="")) 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): |
