From f5b1dcc19487efc636851a16420c9bf07cd1f5c9 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 13 Sep 2016 06:04:51 -0400 Subject: In Python 3.6, fnmatch changed a little bit. Adapt. --- coverage/files.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'coverage/files.py') 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. -- cgit v1.2.1