summaryrefslogtreecommitdiff
path: root/tests/test_api.py
diff options
context:
space:
mode:
authorThomas Grainger <tagrain@gmail.com>2020-09-13 00:26:36 +0100
committerGitHub <noreply@github.com>2020-09-12 19:26:36 -0400
commitecd6ab19a43a444bc7fc9dfbc08f3ca5274365ca (patch)
tree475101c0912dcf031b561acfab88cfaa712401cb /tests/test_api.py
parent39e6d1de90b9574f8eaa266b289a7efc02b2e9e9 (diff)
downloadpython-coveragepy-git-ecd6ab19a43a444bc7fc9dfbc08f3ca5274365ca.tar.gz
Create Way to force package even if filepath exists (#1026)
Fixes: #268
Diffstat (limited to 'tests/test_api.py')
-rw-r--r--tests/test_api.py22
1 files changed, 22 insertions, 0 deletions
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."""