extends samples test-case factory to see the matched regex number and expression in assert message (helps if some similar regexp's available in filter)

pull/2189/head
sebres 2018-07-18 15:30:06 +02:00
parent d92381aaa9
commit 64d9e164cf
1 changed files with 4 additions and 2 deletions

View File

@ -201,6 +201,7 @@ def testSampleRegexsFactory(name, basedir):
flt, regexsUsedIdx = flt
regexList = flt.getFailRegex()
failregex = -1
try:
fail = {}
ret = flt.processLine(line)
@ -263,9 +264,10 @@ def testSampleRegexsFactory(name, basedir):
regexsUsedRe.add(regexList[failregex])
except AssertionError as e: # pragma: no cover
import pprint
raise AssertionError("%s: %s on: %s:%i, line:\n%s\n"
raise AssertionError("%s: %s on: %s:%i, line:\n %sregex (%s):\n %s\n"
"faildata: %s\nfail: %s" % (
fltName, e, logFile.filename(), logFile.filelineno(), line,
fltName, e, logFile.filename(), logFile.filelineno(),
line, failregex, regexList[failregex] if failregex != -1 else None,
'\n'.join(pprint.pformat(faildata).splitlines()),
'\n'.join(pprint.pformat(fail).splitlines())))