CapturingLogHandler: match the fully formatted log message in assertRegex

and not the raw 'msg' attribute which still has the '%' formatting placeholders
This commit is contained in:
Cosimo Lupo 2018-01-15 18:38:27 +00:00
parent bc0480e19e
commit 60f2c741c3
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482

View File

@ -467,7 +467,7 @@ class CapturingLogHandler(logging.Handler):
import re
pattern = re.compile(regexp)
for r in self.records:
if pattern.search(r.msg):
if pattern.search(r.getMessage()):
return True
assert 0, "Pattern '%s' not found in logger records" % regexp