summaryrefslogtreecommitdiff
path: root/coverage/inorout.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-10-23 14:03:17 -0400
committerNed Batchelder <ned@nedbatchelder.com>2022-10-30 15:45:47 -0400
commitec6205a8de972af6a09453235d02a7ebea6aea8e (patch)
tree2e55057dff55197a0466d8189c2bac6b2d03239c /coverage/inorout.py
parentb3a1d979f8625e4974eaa7211cdecb211ba90b50 (diff)
downloadpython-coveragepy-git-ec6205a8de972af6a09453235d02a7ebea6aea8e.tar.gz
fix: use glob matching instead of fnmatch. #1407
I didn't understand that fnmatch considers the entire string to be a filename, even if it has slashes in it. This led to incorrect matching. Now we use our own implementation of glob matching to get the correct behavior.
Diffstat (limited to 'coverage/inorout.py')
-rw-r--r--coverage/inorout.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/coverage/inorout.py b/coverage/inorout.py
index ec89d1b4..2e534c85 100644
--- a/coverage/inorout.py
+++ b/coverage/inorout.py
@@ -16,7 +16,7 @@ import traceback
from coverage import env
from coverage.disposition import FileDisposition, disposition_init
from coverage.exceptions import CoverageException, PluginError
-from coverage.files import TreeMatcher, FnmatchMatcher, ModuleMatcher
+from coverage.files import TreeMatcher, GlobMatcher, ModuleMatcher
from coverage.files import prep_patterns, find_python_files, canonical_filename
from coverage.misc import sys_modules_saved
from coverage.python import source_for_file, source_for_morf
@@ -260,10 +260,10 @@ class InOrOut:
self.pylib_match = TreeMatcher(self.pylib_paths, "pylib")
debug(f"Python stdlib matching: {self.pylib_match!r}")
if self.include:
- self.include_match = FnmatchMatcher(self.include, "include")
+ self.include_match = GlobMatcher(self.include, "include")
debug(f"Include matching: {self.include_match!r}")
if self.omit:
- self.omit_match = FnmatchMatcher(self.omit, "omit")
+ self.omit_match = GlobMatcher(self.omit, "omit")
debug(f"Omit matching: {self.omit_match!r}")
self.cover_match = TreeMatcher(self.cover_paths, "coverage")