diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-09-21 21:45:53 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-09-21 21:45:53 -0400 |
commit | 093b886e2ed7a424aca018b3261a4e38ea4f4216 (patch) | |
tree | 13931d1f89887f8fea07d31610d4bc3ca833a28d /coverage/files.py | |
parent | 5100ffbc9c619e92fbf62203bf08dc8a021d20d7 (diff) | |
download | python-coveragepy-093b886e2ed7a424aca018b3261a4e38ea4f4216.tar.gz |
On Windows, we need file matching to be case-insensitive.
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/coverage/files.py b/coverage/files.py index 40c126e..1ed7276 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -180,8 +180,13 @@ class FnmatchMatcher(object): # fnmatch is platform-specific. On Windows, it does the Windows thing # of treating / and \ as equivalent. But on other platforms, we need to # take care of that ourselves. - fnpats = [fnmatch.translate(p) for p in pats] - fnpats = [p.replace(r"\/", r"[\\/]") for p in fnpats] + fnpats = (fnmatch.translate(p) for p in pats) + fnpats = (p.replace(r"\/", r"[\\/]") for p in fnpats) + if sys.platform == 'win32': + # 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 have two there seems to work fine. + fnpats = (p + "(?i)" for p in fnpats) self.re = re.compile(join_regex(fnpats)) def __repr__(self): |