2015-10-21 22:05:41 +02:00
|
|
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
2017-05-09 21:37:03 +02:00
|
|
|
# Copyright 2015-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
2015-10-21 22:05:41 +02:00
|
|
|
#
|
|
|
|
# This file is part of qutebrowser.
|
|
|
|
#
|
|
|
|
# qutebrowser is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# qutebrowser is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
"""Test the quteproc fixture used for tests."""
|
|
|
|
|
2015-11-09 19:34:34 +01:00
|
|
|
import logging
|
|
|
|
import datetime
|
2016-05-25 23:16:03 +02:00
|
|
|
import json
|
2015-11-09 19:34:34 +01:00
|
|
|
|
2015-10-21 22:05:41 +02:00
|
|
|
import pytest
|
|
|
|
|
2016-05-29 18:20:00 +02:00
|
|
|
from end2end.fixtures import quteprocess, testprocess
|
2015-11-09 19:34:34 +01:00
|
|
|
from qutebrowser.utils import log
|
|
|
|
|
2015-10-21 22:05:41 +02:00
|
|
|
|
2016-08-19 11:48:51 +02:00
|
|
|
class FakeRepCall:
|
|
|
|
|
|
|
|
"""Fake for request.node.rep_call."""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
self.failed = False
|
|
|
|
|
|
|
|
|
|
|
|
class FakeConfig:
|
|
|
|
|
|
|
|
"""Fake for request.config."""
|
|
|
|
|
|
|
|
ARGS = {
|
|
|
|
'--qute-delay': 0,
|
|
|
|
'--color': True,
|
2016-09-12 12:01:31 +02:00
|
|
|
'--verbose': False,
|
2016-08-19 11:48:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
def getoption(self, name):
|
|
|
|
return self.ARGS[name]
|
|
|
|
|
2016-08-19 13:35:39 +02:00
|
|
|
|
2016-08-19 13:11:29 +02:00
|
|
|
class FakeNode:
|
|
|
|
|
2016-08-19 13:35:39 +02:00
|
|
|
"""Fake for request.node."""
|
2016-08-19 13:11:29 +02:00
|
|
|
|
|
|
|
def __init__(self, call):
|
|
|
|
self.rep_call = call
|
|
|
|
|
|
|
|
def get_marker(self, _name):
|
|
|
|
return None
|
|
|
|
|
2016-08-19 11:48:51 +02:00
|
|
|
|
|
|
|
class FakeRequest:
|
|
|
|
|
|
|
|
"""Fake for request."""
|
|
|
|
|
|
|
|
def __init__(self, node, config, httpbin):
|
|
|
|
self.node = node
|
|
|
|
self.config = config
|
|
|
|
self._httpbin = httpbin
|
|
|
|
|
2016-08-22 07:23:54 +02:00
|
|
|
def getfixturevalue(self, name):
|
2016-08-19 11:48:51 +02:00
|
|
|
assert name == 'httpbin'
|
|
|
|
return self._httpbin
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def request_mock(quteproc, monkeypatch, httpbin):
|
|
|
|
"""Patch out a pytest request."""
|
|
|
|
fake_call = FakeRepCall()
|
|
|
|
fake_config = FakeConfig()
|
2016-08-19 13:11:29 +02:00
|
|
|
fake_node = FakeNode(fake_call)
|
2016-08-19 11:48:51 +02:00
|
|
|
fake_request = FakeRequest(fake_node, fake_config, httpbin)
|
|
|
|
assert not hasattr(fake_request.node.rep_call, 'wasxfail')
|
2016-08-19 13:05:59 +02:00
|
|
|
monkeypatch.setattr(quteproc, 'request', fake_request)
|
2016-08-19 11:48:51 +02:00
|
|
|
return fake_request
|
|
|
|
|
|
|
|
|
2016-01-14 06:54:21 +01:00
|
|
|
@pytest.mark.parametrize('cmd', [
|
|
|
|
':message-error test',
|
|
|
|
':jseval console.log("[FAIL] test");'
|
|
|
|
])
|
2016-08-19 11:48:51 +02:00
|
|
|
def test_quteproc_error_message(qtbot, quteproc, cmd, request_mock):
|
2015-10-21 22:05:41 +02:00
|
|
|
"""Make sure the test fails with an unexpected error message."""
|
2016-01-08 09:49:06 +01:00
|
|
|
with qtbot.waitSignal(quteproc.got_error):
|
2016-01-14 06:54:21 +01:00
|
|
|
quteproc.send_cmd(cmd)
|
2015-10-21 22:05:41 +02:00
|
|
|
# Usually we wouldn't call this from inside a test, but here we force the
|
|
|
|
# error to occur during the test rather than at teardown time.
|
|
|
|
with pytest.raises(pytest.fail.Exception):
|
2016-08-19 11:48:51 +02:00
|
|
|
quteproc.after_test()
|
2016-02-04 06:43:14 +01:00
|
|
|
|
|
|
|
|
2016-08-19 11:48:51 +02:00
|
|
|
def test_quteproc_error_message_did_fail(qtbot, quteproc, request_mock):
|
2016-02-04 06:43:14 +01:00
|
|
|
"""Make sure the test does not fail on teardown if the main test failed."""
|
2016-08-19 11:48:51 +02:00
|
|
|
request_mock.node.rep_call.failed = True
|
2016-02-04 06:43:14 +01:00
|
|
|
with qtbot.waitSignal(quteproc.got_error):
|
|
|
|
quteproc.send_cmd(':message-error test')
|
|
|
|
# Usually we wouldn't call this from inside a test, but here we force the
|
|
|
|
# error to occur during the test rather than at teardown time.
|
2016-08-19 11:48:51 +02:00
|
|
|
quteproc.after_test()
|
2015-11-02 06:19:19 +01:00
|
|
|
|
|
|
|
|
2016-01-14 20:32:17 +01:00
|
|
|
def test_quteproc_skip_via_js(qtbot, quteproc):
|
2017-05-23 09:36:00 +02:00
|
|
|
with pytest.raises(pytest.skip.Exception, match='test'):
|
2016-01-14 20:32:17 +01:00
|
|
|
quteproc.send_cmd(':jseval console.log("[SKIP] test");')
|
|
|
|
quteproc.wait_for_js('[SKIP] test')
|
|
|
|
|
|
|
|
# Usually we wouldn't call this from inside a test, but here we force
|
|
|
|
# the error to occur during the test rather than at teardown time.
|
2016-08-19 11:48:51 +02:00
|
|
|
quteproc.after_test()
|
2016-01-14 18:50:36 +01:00
|
|
|
|
2016-01-14 20:32:17 +01:00
|
|
|
|
|
|
|
def test_quteproc_skip_and_wait_for(qtbot, quteproc):
|
|
|
|
"""This test will skip *again* during teardown, but we don't care."""
|
|
|
|
with pytest.raises(pytest.skip.Exception):
|
|
|
|
quteproc.send_cmd(':jseval console.log("[SKIP] foo");')
|
|
|
|
quteproc.wait_for_js("[SKIP] foo")
|
|
|
|
quteproc.wait_for(message='This will not match')
|
2016-01-14 18:50:36 +01:00
|
|
|
|
|
|
|
|
2015-11-02 06:19:19 +01:00
|
|
|
def test_qt_log_ignore(qtbot, quteproc):
|
|
|
|
"""Make sure the test passes when logging a qt_log_ignore message."""
|
2016-01-08 09:49:06 +01:00
|
|
|
with qtbot.waitSignal(quteproc.got_error):
|
2015-11-02 06:19:19 +01:00
|
|
|
quteproc.send_cmd(':message-error "SpellCheck: test"')
|
2015-11-09 19:34:34 +01:00
|
|
|
|
|
|
|
|
2016-01-17 20:46:55 +01:00
|
|
|
def test_quteprocess_quitting(qtbot, quteproc_process):
|
|
|
|
"""When qutebrowser quits, after_test should fail."""
|
2016-01-18 23:00:41 +01:00
|
|
|
with qtbot.waitSignal(quteproc_process.proc.finished, timeout=15000):
|
2016-01-17 20:46:55 +01:00
|
|
|
quteproc_process.send_cmd(':quit')
|
|
|
|
with pytest.raises(testprocess.ProcessExited):
|
2016-08-19 11:48:51 +02:00
|
|
|
quteproc_process.after_test()
|
2016-01-17 20:46:55 +01:00
|
|
|
|
|
|
|
|
2015-11-09 19:34:34 +01:00
|
|
|
@pytest.mark.parametrize('data, attrs', [
|
2017-05-23 08:08:46 +02:00
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
'{"created": 86400, "msecs": 0, "levelname": "DEBUG", "name": "init", '
|
2016-09-06 16:22:31 +02:00
|
|
|
'"module": "earlyinit", "funcName": "init_log", "lineno": 280, '
|
|
|
|
'"levelno": 10, "message": "Log initialized."}',
|
2015-11-09 19:34:34 +01:00
|
|
|
{
|
2017-03-28 20:53:11 +02:00
|
|
|
'timestamp': datetime.datetime.fromtimestamp(86400),
|
2015-11-09 19:34:34 +01:00
|
|
|
'loglevel': logging.DEBUG,
|
|
|
|
'category': 'init',
|
|
|
|
'module': 'earlyinit',
|
|
|
|
'function': 'init_log',
|
2016-01-21 18:07:56 +01:00
|
|
|
'line': 280,
|
2015-11-09 19:34:34 +01:00
|
|
|
'message': 'Log initialized.',
|
|
|
|
'expected': False,
|
2017-05-23 08:08:46 +02:00
|
|
|
},
|
|
|
|
id='normal'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
'{"created": 86400, "msecs": 0, "levelname": "VDEBUG", "name": "foo", '
|
2016-09-06 16:22:31 +02:00
|
|
|
'"module": "foo", "funcName": "foo", "lineno": 0, "levelno": 9, '
|
|
|
|
'"message": ""}',
|
2017-05-23 08:08:46 +02:00
|
|
|
{'loglevel': log.VDEBUG_LEVEL},
|
|
|
|
id='vdebug'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
'{"created": 86400, "msecs": 0, "levelname": "DEBUG", "name": "qt", '
|
2016-09-06 16:22:31 +02:00
|
|
|
'"module": null, "funcName": null, "lineno": 0, "levelno": 10, '
|
|
|
|
'"message": "test"}',
|
2015-11-09 19:34:34 +01:00
|
|
|
{'module': None, 'function': None, 'line': None},
|
2017-05-23 08:08:46 +02:00
|
|
|
id='unknown module'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
'{"created": 86400, "msecs": 0, "levelname": "VDEBUG", "name": "foo", '
|
2016-09-06 16:22:31 +02:00
|
|
|
'"module": "foo", "funcName": "foo", "lineno": 0, "levelno": 9, '
|
|
|
|
'"message": "SpellCheck: test"}',
|
2015-11-09 19:34:34 +01:00
|
|
|
{'expected': True},
|
2017-05-23 08:08:46 +02:00
|
|
|
id='expected message'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
'{"created": 86400, "msecs": 0, "levelname": "DEBUG", "name": "qt", '
|
2016-09-06 16:22:31 +02:00
|
|
|
'"module": "qnetworkreplyhttpimpl", "funcName": '
|
2016-05-25 23:16:03 +02:00
|
|
|
'"void QNetworkReplyHttpImplPrivate::error('
|
|
|
|
'QNetworkReply::NetworkError, const QString&)", "lineno": 1929, '
|
|
|
|
'"levelno": 10, "message": "QNetworkReplyImplPrivate::error: '
|
|
|
|
'Internal problem, this method must only be called once."}',
|
2015-11-09 19:55:05 +01:00
|
|
|
{
|
|
|
|
'module': 'qnetworkreplyhttpimpl',
|
|
|
|
'function': 'void QNetworkReplyHttpImplPrivate::error('
|
|
|
|
'QNetworkReply::NetworkError, const QString&)',
|
|
|
|
'line': 1929
|
2017-05-23 08:08:46 +02:00
|
|
|
},
|
|
|
|
id='weird Qt location'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
'{"created": 86400, "msecs": 0, "levelname": "DEBUG", "name": "qt", '
|
2016-09-06 16:22:31 +02:00
|
|
|
'"module": "qxcbxsettings", "funcName": "QXcbXSettings::QXcbXSettings('
|
2016-05-25 23:16:03 +02:00
|
|
|
'QXcbScreen*)", "lineno": 233, "levelno": 10, "message": '
|
|
|
|
'"QXcbXSettings::QXcbXSettings(QXcbScreen*) Failed to get selection '
|
|
|
|
'owner for XSETTINGS_S atom"}',
|
2015-11-09 19:55:05 +01:00
|
|
|
{
|
|
|
|
'module': 'qxcbxsettings',
|
|
|
|
'function': 'QXcbXSettings::QXcbXSettings(QXcbScreen*)',
|
|
|
|
'line': 233,
|
2017-05-23 08:08:46 +02:00
|
|
|
},
|
|
|
|
id='QXcbXSettings'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
'{"created": 86400, "msecs": 0, "levelname": "WARNING", '
|
2016-09-06 16:22:31 +02:00
|
|
|
'"name": "py.warnings", "module": "app", "funcName": "qt_mainloop", '
|
|
|
|
'"lineno": 121, "levelno": 30, "message": '
|
2016-05-25 23:16:03 +02:00
|
|
|
'".../app.py:121: ResourceWarning: unclosed file <_io.TextIOWrapper '
|
|
|
|
'name=18 mode=\'r\' encoding=\'UTF-8\'>"}',
|
2017-05-23 08:08:46 +02:00
|
|
|
{'category': 'py.warnings'},
|
|
|
|
id='resourcewarning'),
|
|
|
|
])
|
2015-11-09 19:34:34 +01:00
|
|
|
def test_log_line_parse(data, attrs):
|
|
|
|
line = quteprocess.LogLine(data)
|
|
|
|
for name, expected in attrs.items():
|
|
|
|
actual = getattr(line, name)
|
|
|
|
assert actual == expected, name
|
|
|
|
|
|
|
|
|
2016-07-02 13:51:10 +02:00
|
|
|
@pytest.mark.parametrize('data, colorized, expect_error, expected', [
|
2017-05-23 08:08:46 +02:00
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
{'created': 86400, 'msecs': 0, 'levelname': 'DEBUG', 'name': 'foo',
|
2016-09-06 16:22:31 +02:00
|
|
|
'module': 'bar', 'funcName': 'qux', 'lineno': 10, 'levelno': 10,
|
|
|
|
'message': 'quux'},
|
2016-07-02 13:51:10 +02:00
|
|
|
False, False,
|
2016-05-26 15:39:14 +02:00
|
|
|
'{timestamp} DEBUG foo bar:qux:10 quux',
|
2017-05-23 08:08:46 +02:00
|
|
|
id='normal'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
{'created': 86400, 'msecs': 0, 'levelname': 'DEBUG', 'name': 'foo',
|
2016-09-06 16:22:31 +02:00
|
|
|
'module': 'bar', 'funcName': 'qux', 'lineno': 10, 'levelno': 10,
|
|
|
|
'message': 'quux', 'traceback': 'Traceback (most recent call '
|
|
|
|
'last):\n here be dragons'},
|
2016-07-02 13:51:10 +02:00
|
|
|
False, False,
|
2016-05-26 15:39:14 +02:00
|
|
|
'{timestamp} DEBUG foo bar:qux:10 quux\n'
|
2016-05-25 23:16:03 +02:00
|
|
|
'Traceback (most recent call last):\n'
|
2016-09-06 16:22:31 +02:00
|
|
|
' here be dragons',
|
2017-05-23 08:08:46 +02:00
|
|
|
id='traceback'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
{'created': 86400, 'msecs': 0, 'levelname': 'DEBUG', 'name': 'foo',
|
2016-09-06 16:22:31 +02:00
|
|
|
'module': 'bar', 'funcName': 'qux', 'lineno': 10, 'levelno': 10,
|
|
|
|
'message': 'quux'},
|
2016-07-02 13:51:10 +02:00
|
|
|
True, False,
|
2016-05-26 16:09:59 +02:00
|
|
|
'\033[32m{timestamp}\033[0m \033[37mDEBUG \033[0m \033[36mfoo '
|
|
|
|
' bar:qux:10\033[0m \033[37mquux\033[0m',
|
2017-05-23 08:08:46 +02:00
|
|
|
id='colored'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
{'created': 86400, 'msecs': 0, 'levelname': 'ERROR', 'name': 'foo',
|
2016-09-06 16:22:31 +02:00
|
|
|
'module': 'bar', 'funcName': 'qux', 'lineno': 10, 'levelno': 40,
|
|
|
|
'message': 'quux'},
|
2016-07-02 13:51:10 +02:00
|
|
|
False, True,
|
2016-07-02 17:22:40 +02:00
|
|
|
'{timestamp} ERROR (expected) foo bar:qux:10 quux',
|
2017-05-23 08:08:46 +02:00
|
|
|
id='expected error'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
{'created': 86400, 'msecs': 0, 'levelname': 'DEBUG', 'name': 'foo',
|
2016-09-06 16:22:31 +02:00
|
|
|
'module': 'bar', 'funcName': 'qux', 'lineno': 10, 'levelno': 10,
|
|
|
|
'message': 'quux'},
|
2016-07-02 13:51:10 +02:00
|
|
|
False, True,
|
|
|
|
'{timestamp} DEBUG foo bar:qux:10 quux',
|
2017-05-23 08:08:46 +02:00
|
|
|
id='expected other'),
|
|
|
|
|
|
|
|
pytest.param(
|
2017-03-28 20:53:11 +02:00
|
|
|
{'created': 86400, 'msecs': 0, 'levelname': 'ERROR', 'name': 'foo',
|
2016-09-06 16:22:31 +02:00
|
|
|
'module': 'bar', 'funcName': 'qux', 'lineno': 10, 'levelno': 40,
|
|
|
|
'message': 'quux'},
|
2016-07-02 13:51:10 +02:00
|
|
|
True, True,
|
2016-07-02 17:22:40 +02:00
|
|
|
'\033[32m{timestamp}\033[0m \033[37mERROR (expected)\033[0m '
|
2016-07-02 16:51:58 +02:00
|
|
|
'\033[36mfoo bar:qux:10\033[0m \033[37mquux\033[0m',
|
2017-05-23 08:08:46 +02:00
|
|
|
id='expected error colorized'),
|
|
|
|
])
|
2016-07-02 13:51:10 +02:00
|
|
|
def test_log_line_formatted(data, colorized, expect_error, expected):
|
2016-05-25 23:16:03 +02:00
|
|
|
line = json.dumps(data)
|
|
|
|
record = quteprocess.LogLine(line)
|
2016-07-02 13:51:10 +02:00
|
|
|
record.expected = expect_error
|
2016-05-26 15:39:14 +02:00
|
|
|
ts = datetime.datetime.fromtimestamp(data['created']).strftime('%H:%M:%S')
|
2016-09-06 16:22:31 +02:00
|
|
|
ts += '.{:03.0f}'.format(data['msecs'])
|
2016-05-26 15:39:14 +02:00
|
|
|
expected = expected.format(timestamp=ts)
|
2016-05-25 23:16:03 +02:00
|
|
|
assert record.formatted_str(colorized=colorized) == expected
|
|
|
|
|
|
|
|
|
2015-11-09 19:34:34 +01:00
|
|
|
def test_log_line_no_match():
|
2015-11-16 23:14:24 +01:00
|
|
|
with pytest.raises(testprocess.InvalidLine):
|
2015-11-09 19:34:34 +01:00
|
|
|
quteprocess.LogLine("Hello World!")
|
2016-03-29 20:45:15 +02:00
|
|
|
|
|
|
|
|
2016-08-18 13:24:47 +02:00
|
|
|
class TestClickElementByText:
|
2016-03-29 20:45:15 +02:00
|
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
def open_page(self, quteproc):
|
|
|
|
quteproc.open_path('data/click_element.html')
|
|
|
|
|
|
|
|
def test_click_element(self, quteproc):
|
2016-08-18 13:24:47 +02:00
|
|
|
quteproc.click_element_by_text('Test Element')
|
2016-03-29 20:45:15 +02:00
|
|
|
quteproc.wait_for_js('click_element clicked')
|
|
|
|
|
|
|
|
def test_click_special_chars(self, quteproc):
|
2016-08-18 13:24:47 +02:00
|
|
|
quteproc.click_element_by_text('"Don\'t", he shouted')
|
2016-03-29 20:45:15 +02:00
|
|
|
quteproc.wait_for_js('click_element special chars')
|
|
|
|
|
|
|
|
def test_duplicate(self, quteproc):
|
2017-05-23 09:36:00 +02:00
|
|
|
with pytest.raises(ValueError, match='not unique'):
|
2016-08-18 13:24:47 +02:00
|
|
|
quteproc.click_element_by_text('Duplicate')
|
2016-03-29 20:45:15 +02:00
|
|
|
|
|
|
|
def test_nonexistent(self, quteproc):
|
2017-05-23 09:36:00 +02:00
|
|
|
with pytest.raises(ValueError, match='No element'):
|
2016-08-18 13:24:47 +02:00
|
|
|
quteproc.click_element_by_text('no element exists with this text')
|
|
|
|
|
|
|
|
|
2016-03-29 20:45:15 +02:00
|
|
|
@pytest.mark.parametrize('string, expected', [
|
|
|
|
('Test', "'Test'"),
|
|
|
|
("Don't", '"Don\'t"'),
|
|
|
|
# This is some serious string escaping madness
|
2016-03-29 21:02:54 +02:00
|
|
|
('"Don\'t", he said',
|
|
|
|
"concat('\"', 'Don', \"'\", 't', '\"', ', he said')"),
|
2016-03-29 20:45:15 +02:00
|
|
|
])
|
|
|
|
def test_xpath_escape(string, expected):
|
|
|
|
assert quteprocess._xpath_escape(string) == expected
|
2016-04-06 08:13:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('value', [
|
|
|
|
'foo',
|
|
|
|
'foo"bar', # Make sure a " is preserved
|
|
|
|
])
|
|
|
|
def test_set(quteproc, value):
|
2017-06-16 16:22:41 +02:00
|
|
|
quteproc.set_setting('content.default_encoding', value)
|
|
|
|
read_back = quteproc.get_setting('content.default_encoding')
|
2016-04-06 08:13:43 +02:00
|
|
|
assert read_back == value
|
2017-06-06 16:26:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('message, ignored', [
|
|
|
|
# Unparseable
|
|
|
|
('Hello World', False),
|
|
|
|
# Without process/thread ID
|
|
|
|
('[0606/135039:ERROR:cert_verify_proc_nss.cc(925)] CERT_PKIXVerifyCert '
|
|
|
|
'for localhost failed err=-8179', True),
|
|
|
|
# Random ignored message
|
|
|
|
('[26598:26598:0605/191429.639416:WARNING:audio_manager.cc(317)] Multiple '
|
|
|
|
'instances of AudioManager detected', True),
|
|
|
|
# Not ignored
|
|
|
|
('[26598:26598:0605/191429.639416:WARNING:audio_manager.cc(317)] Test',
|
|
|
|
False),
|
|
|
|
])
|
|
|
|
def test_is_ignored_chromium_message(message, ignored):
|
|
|
|
assert quteprocess.is_ignored_chromium_message(message) == ignored
|