tests: Strip [2s ago] markers from log messages.

This commit is contained in:
Florian Bruhin 2015-11-10 09:23:18 +01:00
parent e1c6cd6c6d
commit ada4b669bc
2 changed files with 10 additions and 2 deletions

View File

@ -69,7 +69,7 @@ class LogLine(testprocess.Line):
\ (?P<loglevel>VDEBUG|DEBUG|INFO|WARNING|ERROR)
\ +(?P<category>\w+)
\ +(?P<module>(\w+|Unknown\ module)):
(?P<function>[^"][^:]*|"[^"]+"):
(?P<function>[^"][^:]*|"[^"]+"):
(?P<line>\d+)
\ (?P<message>.+)
""", re.VERBOSE)
@ -108,7 +108,10 @@ class LogLine(testprocess.Line):
else:
self.line = line
self.message = match.group('message')
msg_match = re.match(r'^(\[(?P<prefix>\d+s ago)\] )?(?P<message>.*)',
match.group('message'))
self.prefix = msg_match.group('prefix')
self.message = msg_match.group('message')
self.expected = is_ignored_qt_message(self.message)

View File

@ -99,6 +99,11 @@ def test_qt_log_ignore(qtbot, quteproc):
'line': 233,
}
),
(
# With [2s ago] marker
'00:00:00 DEBUG foo foo:foo:0 [2s ago] test',
{'prefix': '2s ago', 'message': 'test'}
),
])
def test_log_line_parse(data, attrs):
line = quteprocess.LogLine(data)