tests: Ignore some Qt warnings during teardown.
This commit is contained in:
parent
7e0e770d53
commit
f5eb755ef3
@ -34,3 +34,4 @@ qt_log_ignore =
|
||||
^virtual void QSslSocketBackendPrivate::transmit\(\) SSLRead failed with: -9805
|
||||
^Type conversion already registered from type .*
|
||||
^QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once\.
|
||||
^QWaitCondition: Destroyed while threads are still waiting
|
||||
|
@ -37,6 +37,15 @@ from qutebrowser.misc import ipc
|
||||
from qutebrowser.utils import log
|
||||
|
||||
|
||||
def is_ignored_qt_message(message):
|
||||
"""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, message):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class NoLineMatch(Exception):
|
||||
|
||||
"""Raised by LogLine on unmatched lines."""
|
||||
@ -90,19 +99,11 @@ class LogLine:
|
||||
self.line = int(match.group('line'))
|
||||
self.message = match.group('message')
|
||||
|
||||
self.expected = self._is_ignored()
|
||||
self.expected = is_ignored_qt_message(self.message)
|
||||
|
||||
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):
|
||||
|
||||
@ -129,9 +130,7 @@ class QuteProc(testprocess.Process):
|
||||
return None
|
||||
elif not line.strip():
|
||||
return None
|
||||
elif (line == "QWaitCondition: Destroyed while threads are still "
|
||||
"waiting"):
|
||||
# Happens on Windows during exit sometimes
|
||||
elif is_ignored_qt_message(line):
|
||||
return None
|
||||
else:
|
||||
raise testprocess.InvalidLine
|
||||
|
Loading…
Reference in New Issue
Block a user