diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/modules/ambigious/__init__.py | 0 | ||||
-rw-r--r-- | tests/modules/ambigious/pkg1/__init__.py | 0 | ||||
-rw-r--r-- | tests/modules/ambigious/pkg1/ambigious.py | 0 | ||||
-rw-r--r-- | tests/test_api.py | 22 | ||||
-rw-r--r-- | tests/test_config.py | 2 |
5 files changed, 24 insertions, 0 deletions
diff --git a/tests/modules/ambigious/__init__.py b/tests/modules/ambigious/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/modules/ambigious/__init__.py diff --git a/tests/modules/ambigious/pkg1/__init__.py b/tests/modules/ambigious/pkg1/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/modules/ambigious/pkg1/__init__.py diff --git a/tests/modules/ambigious/pkg1/ambigious.py b/tests/modules/ambigious/pkg1/ambigious.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/modules/ambigious/pkg1/ambigious.py diff --git a/tests/test_api.py b/tests/test_api.py index ab4b8a8f..7311073a 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -935,6 +935,28 @@ class SourceIncludeOmitTest(IncludeOmitTestsMixin, CoverageTest): self.filenames_not_in(lines, "p1b") self.assertEqual(lines['p1c'], 0) + def test_ambigious_source_package_as_dir(self): + # pkg1 is a directory and a pkg, since we cd into tests/modules/ambigious + self.chdir(self.nice_file(TESTS_DIR, 'modules', "ambigious")) + # pkg1 defaults to directory because tests/modules/ambigious/pkg1 exists + lines = self.coverage_usepkgs(source=["pkg1"]) + self.assertEqual( + self.coverage_usepkgs(source=["pkg1"]), + { + u"__init__.py": 0, u"__init__": 0, + u"ambigious.py": 0, u"ambigious": 0, + }, + ) + + def test_ambigious_source_package_as_package(self): + # pkg1 is a directory and a pkg, since we cd into tests/modules/ambigious + self.chdir(self.nice_file(TESTS_DIR, 'modules', "ambigious")) + lines = self.coverage_usepkgs(source_pkgs=["pkg1"]) + self.filenames_in(lines, "p1a p1b") + self.filenames_not_in(lines, "p2a p2b othera otherb osa osb ambigious") + # Because source= was specified, we do search for unexecuted files. + self.assertEqual(lines['p1c'], 0) + class ReportIncludeOmitTest(IncludeOmitTestsMixin, CoverageTest): """Tests of the report include/omit functionality.""" diff --git a/tests/test_config.py b/tests/test_config.py index 89ecb17c..dd86303f 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -462,6 +462,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): ; this omit is overriden by the omit from [report] omit = twenty source = myapp + source_pkgs = ned plugins = plugins.a_plugin plugins.another @@ -553,6 +554,7 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest): self.assertTrue(cov.config.parallel) self.assertEqual(cov.config.concurrency, ["thread"]) self.assertEqual(cov.config.source, ["myapp"]) + self.assertEqual(cov.config.source_pkgs, ["ned"]) self.assertEqual(cov.config.disable_warnings, ["abcd", "efgh"]) self.assertEqual(cov.get_exclude_list(), ["if 0:", r"pragma:?\s+no cover", "another_tab"]) |