diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-09-13 06:04:51 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-09-13 06:04:51 -0400 |
commit | ec1d421aceb871b3b95cad2a6fbbec7c2c10e87b (patch) | |
tree | dc27f55e24ca1601e489534e6e343ca0ec39930c /coverage/files.py | |
parent | e437f54e41a90740e5529931f742b0f15bbfd94e (diff) | |
download | python-coveragepy-ec1d421aceb871b3b95cad2a6fbbec7c2c10e87b.tar.gz |
In Python 3.6, fnmatch changed a little bit. Adapt.
Diffstat (limited to 'coverage/files.py')
-rw-r--r-- | coverage/files.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/coverage/files.py b/coverage/files.py index 44997d1..9de4849 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -313,8 +313,11 @@ class PathAliases(object): pattern += pattern_sep # Make a regex from the pattern. fnmatch always adds a \Z to - # match the whole string, which we don't want. - regex_pat = fnmatch.translate(pattern).replace(r'\Z(', '(') + # match the whole string, which we don't want, so we remove the \Z. + # While removing it, we only replace \Z if followed by paren, or at + # end, to keep from destroying a literal \Z in the pattern. + regex_pat = fnmatch.translate(pattern) + regex_pat = re.sub(r'\\Z(\(|$)', r'\1', regex_pat) # We want */a/b.py to match on Windows too, so change slash to match # either separator. |