Ignore messages which are in qt_log_ignore.
This commit is contained in:
parent
6dc3b5de36
commit
56758c8cea
@ -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):
|
||||
|
||||
|
@ -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"')
|
||||
|
Loading…
Reference in New Issue
Block a user