Make tests for non-ASCII files work
This commit is contained in:
parent
743dbbbcd6
commit
fdc43438ef
@ -190,6 +190,10 @@ def is_ignored_chromium_message(line):
|
|||||||
# on receiving Mach ports FFA56F125F699ADB.E28E252911A8704B. Dropping
|
# on receiving Mach ports FFA56F125F699ADB.E28E252911A8704B. Dropping
|
||||||
# message.
|
# message.
|
||||||
'Error on receiving Mach ports *. Dropping message.',
|
'Error on receiving Mach ports *. Dropping message.',
|
||||||
|
|
||||||
|
# [2734:2746:1107/131154.072032:ERROR:nss_ocsp.cc(591)] No
|
||||||
|
# URLRequestContext for NSS HTTP handler. host: ocsp.digicert.com
|
||||||
|
'No URLRequestContext for NSS HTTP handler. host: *',
|
||||||
]
|
]
|
||||||
return any(testutils.pattern_match(pattern=pattern, value=message)
|
return any(testutils.pattern_match(pattern=pattern, value=message)
|
||||||
for pattern in ignored_messages)
|
for pattern in ignored_messages)
|
||||||
@ -572,6 +576,12 @@ class QuteProc(testprocess.Process):
|
|||||||
self.wait_for(category='ipc', module='ipc', function='on_ready_read',
|
self.wait_for(category='ipc', module='ipc', function='on_ready_read',
|
||||||
message='Read from socket *')
|
message='Read from socket *')
|
||||||
|
|
||||||
|
def start(self, *args, wait_focus=True,
|
||||||
|
**kwargs): # pylint: disable=arguments-differ
|
||||||
|
if not wait_focus:
|
||||||
|
self._focus_ready = True
|
||||||
|
super().start(*args, **kwargs)
|
||||||
|
|
||||||
def send_cmd(self, command, count=None, invalid=False, *, escape=True):
|
def send_cmd(self, command, count=None, invalid=False, *, escape=True):
|
||||||
"""Send a command to the running qutebrowser instance.
|
"""Send a command to the running qutebrowser instance.
|
||||||
|
|
||||||
|
@ -103,20 +103,27 @@ def test_downloads_with_ascii_locale(request, server, tmpdir, quteproc_new):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.linux
|
@pytest.mark.linux
|
||||||
def test_open_with_ascii_locale(request, server, tmpdir, quteproc_new):
|
@pytest.mark.parametrize('url', ['/föö.html', 'file:///föö.html'])
|
||||||
|
def test_open_with_ascii_locale(request, server, tmpdir, quteproc_new, url):
|
||||||
"""Test opening non-ascii URL with LC_ALL=C set.
|
"""Test opening non-ascii URL with LC_ALL=C set.
|
||||||
|
|
||||||
https://github.com/qutebrowser/qutebrowser/issues/1450
|
https://github.com/qutebrowser/qutebrowser/issues/1450
|
||||||
"""
|
"""
|
||||||
args = ['--temp-basedir'] + _base_args(request.config)
|
args = ['--temp-basedir'] + _base_args(request.config)
|
||||||
quteproc_new.start(args, env={'LC_ALL': 'C'})
|
quteproc_new.start(args, env={'LC_ALL': 'C'})
|
||||||
|
quteproc_new.set_setting('url.auto_search', 'never')
|
||||||
|
|
||||||
# Test opening a file whose name contains non-ascii characters.
|
# Test opening a file whose name contains non-ascii characters.
|
||||||
# No exception thrown means test success.
|
# No exception thrown means test success.
|
||||||
url = 'file:///föö.html'
|
|
||||||
quteproc_new.send_cmd(':open {}'.format(url))
|
quteproc_new.send_cmd(':open {}'.format(url))
|
||||||
quteproc_new.wait_for(category='url',
|
|
||||||
message='URL contains characters *')
|
if not request.config.webengine:
|
||||||
|
line = quteproc_new.wait_for(message="Error while loading *: Error "
|
||||||
|
"opening /*: No such file or directory")
|
||||||
|
line.expected = True
|
||||||
|
|
||||||
|
quteproc_new.wait_for(message="load status for <* tab_id=* "
|
||||||
|
"url='*/f%C3%B6%C3%B6.html'>: LoadStatus.error")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.linux
|
@pytest.mark.linux
|
||||||
@ -130,7 +137,15 @@ def test_open_command_line_with_ascii_locale(request, server, tmpdir,
|
|||||||
# all be called. No exception thrown means test success.
|
# all be called. No exception thrown means test success.
|
||||||
args = (['--temp-basedir'] + _base_args(request.config) +
|
args = (['--temp-basedir'] + _base_args(request.config) +
|
||||||
['/home/user/föö.html'])
|
['/home/user/föö.html'])
|
||||||
quteproc_new.start(args, env={'LC_ALL': 'C'})
|
quteproc_new.start(args, env={'LC_ALL': 'C'}, wait_focus=False)
|
||||||
|
|
||||||
|
if not request.config.webengine:
|
||||||
|
line = quteproc_new.wait_for(message="Error while loading *: Error "
|
||||||
|
"opening /*: No such file or directory")
|
||||||
|
line.expected = True
|
||||||
|
|
||||||
|
quteproc_new.wait_for(message="load status for <* tab_id=* "
|
||||||
|
"url='*/f*.html'>: LoadStatus.error")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.linux
|
@pytest.mark.linux
|
||||||
|
Loading…
Reference in New Issue
Block a user