From 56758c8cea89c070e00304f363e3a2d54ca900af Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 2 Nov 2015 06:19:19 +0100 Subject: [PATCH] Ignore messages which are in qt_log_ignore. --- tests/integration/quteprocess.py | 10 +++++++++- tests/integration/test_quteprocess.py | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index 48e23fc4c..8a5423da0 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -90,11 +90,19 @@ class LogLine: self.line = int(match.group('line')) self.message = match.group('message') - self.expected = False + self.expected = self._is_ignored() def __repr__(self): return 'LogLine({!r})'.format(self._line) + def _is_ignored(self): + """Check if the message is listed in qt_log_ignore.""" + regexes = pytest.config.getini('qt_log_ignore') + for regex in regexes: + if re.match(regex, self.message): + return True + return False + class QuteProc(testprocess.Process): diff --git a/tests/integration/test_quteprocess.py b/tests/integration/test_quteprocess.py index e891eea80..8fdfe1593 100644 --- a/tests/integration/test_quteprocess.py +++ b/tests/integration/test_quteprocess.py @@ -30,3 +30,9 @@ def test_quteproc_error_message(qtbot, quteproc): # error to occur during the test rather than at teardown time. with pytest.raises(pytest.fail.Exception): quteproc.after_test() + + +def test_qt_log_ignore(qtbot, quteproc): + """Make sure the test passes when logging a qt_log_ignore message.""" + with qtbot.waitSignal(quteproc.got_error, raising=True): + quteproc.send_cmd(':message-error "SpellCheck: test"')