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 | f5b1dcc19487efc636851a16420c9bf07cd1f5c9 (patch) | |
tree | 5211fb0d877708ccdcd0eb4ae3bc7e76d446f601 /coverage/files.py | |
parent | 8bd317babfb6ad7ca1cb1d9c364f32fc9a385395 (diff) | |
download | python-coveragepy-git-f5b1dcc19487efc636851a16420c9bf07cd1f5c9.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 44997d12..9de4849c 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. |