summaryrefslogtreecommitdiff
path: root/coverage/files.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-10-12 21:45:47 -0400
committerNed Batchelder <ned@nedbatchelder.com>2017-10-12 21:45:47 -0400
commit5c161a523893c7608fabf0ffa56d0099f8fa2b5f (patch)
tree59e19acedc41d4f57930b976937d5ee665a729db /coverage/files.py
parentfeadb6992650cc2ac95fa6fa41c1c216022a5d33 (diff)
downloadpython-coveragepy-git-5c161a523893c7608fabf0ffa56d0099f8fa2b5f.tar.gz
Avoid a deprecation warning (from https://github.com/nedbat/coveragepy/pull/33)
Diffstat (limited to 'coverage/files.py')
-rw-r--r--coverage/files.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/coverage/files.py b/coverage/files.py
index d573f223..346043da 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -260,12 +260,11 @@ class FnmatchMatcher(object):
# Python3.7 fnmatch translates "/" as "/", before that, it translates as "\/",
# so we have to deal with maybe a backslash.
fnpats = (re.sub(r"\\?/", r"[\\\\/]", p) for p in fnpats)
+ flags = 0
if env.WINDOWS:
- # Windows is also case-insensitive. BTW: the regex docs say that
- # flags like (?i) have to be at the beginning, but fnmatch puts
- # them at the end, and having two there seems to work fine.
- fnpats = (p + "(?i)" for p in fnpats)
- self.re = re.compile(join_regex(fnpats))
+ # Windows is also case-insensitive, so make the regex case-insensitive.
+ flags |= re.IGNORECASE
+ self.re = re.compile(join_regex(fnpats), flags=flags)
def __repr__(self):
return "<FnmatchMatcher %r>" % self.pats