Add a test for cmd instance with wrong backend
This commit is contained in:
parent
fd8e66136f
commit
34e39bed4e
@ -518,7 +518,6 @@ class Command:
|
|||||||
e.status, e))
|
e.status, e))
|
||||||
return
|
return
|
||||||
self._count = count
|
self._count = count
|
||||||
# FIXME add tests for the _check_prerequisites move!
|
|
||||||
self._check_prerequisites(win_id)
|
self._check_prerequisites(win_id)
|
||||||
posargs, kwargs = self._get_call_args(win_id)
|
posargs, kwargs = self._get_call_args(win_id)
|
||||||
log.commands.debug('Calling {}'.format(
|
log.commands.debug('Calling {}'.format(
|
||||||
|
@ -393,3 +393,22 @@ class TestRun:
|
|||||||
def test_no_args(self):
|
def test_no_args(self):
|
||||||
cmd = _get_cmd()
|
cmd = _get_cmd()
|
||||||
cmd.run(win_id=0)
|
cmd.run(win_id=0)
|
||||||
|
|
||||||
|
def test_instance_unavailable_with_backend(self, fake_args):
|
||||||
|
"""Test what happens when a backend doesn't have an objreg object.
|
||||||
|
|
||||||
|
For example, QtWebEngine doesn't have 'hintmanager' registered. We make
|
||||||
|
sure the backend checking happens before resolving the instance, so we
|
||||||
|
display an error instead of crashing.
|
||||||
|
"""
|
||||||
|
@cmdutils.register(instance='doesnotexist',
|
||||||
|
backend=tabmod.Backend.QtWebEngine)
|
||||||
|
def fun(self):
|
||||||
|
"""Blah."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
fake_args.backend = 'webkit'
|
||||||
|
cmd = cmdutils.cmd_dict['fun']
|
||||||
|
with pytest.raises(cmdexc.PrerequisitesError) as excinfo:
|
||||||
|
cmd.run(win_id=0)
|
||||||
|
assert str(excinfo.value).endswith(' backend.')
|
||||||
|
Loading…
Reference in New Issue
Block a user