From ada4b669bc68ff764df3345904dca87411fbeaa3 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 10 Nov 2015 09:23:18 +0100 Subject: [PATCH] tests: Strip [2s ago] markers from log messages. --- tests/integration/quteprocess.py | 7 +++++-- tests/integration/test_quteprocess.py | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index 8989d3911..ac92d1f00 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -69,7 +69,7 @@ class LogLine(testprocess.Line): \ (?PVDEBUG|DEBUG|INFO|WARNING|ERROR) \ +(?P\w+) \ +(?P(\w+|Unknown\ module)): - (?P[^"][^:]*|"[^"]+"): + (?P[^"][^:]*|"[^"]+"): (?P\d+) \ (?P.+) """, 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\d+s ago)\] )?(?P.*)', + match.group('message')) + self.prefix = msg_match.group('prefix') + self.message = msg_match.group('message') self.expected = is_ignored_qt_message(self.message) diff --git a/tests/integration/test_quteprocess.py b/tests/integration/test_quteprocess.py index a301b5115..ad2f3da97 100644 --- a/tests/integration/test_quteprocess.py +++ b/tests/integration/test_quteprocess.py @@ -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)