From f5eb755ef38794564c65113d43159869e97dc851 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 3 Nov 2015 06:38:48 +0100 Subject: [PATCH] tests: Ignore some Qt warnings during teardown. --- pytest.ini | 1 + tests/integration/quteprocess.py | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pytest.ini b/pytest.ini index 2d4ad2c4b..050246538 100644 --- a/pytest.ini +++ b/pytest.ini @@ -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 diff --git a/tests/integration/quteprocess.py b/tests/integration/quteprocess.py index 8a5423da0..736466802 100644 --- a/tests/integration/quteprocess.py +++ b/tests/integration/quteprocess.py @@ -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