def test_on_config_changed(configdata_init, hook, module, option_filter, option, called): module.info.config_changed_hooks = [(option_filter, hook)] info = loader.ExtensionInfo(name='testmodule') loader._load_component(info) loader._on_config_changed(option) assert hook.called == called
def test_skip_hooks(hook, module): hook.raising = True module.info.init_hook = hook module.info.config_changed_hooks = [(None, hook)] info = loader.ExtensionInfo(name='testmodule') loader._load_component(info, skip_hooks=True) loader._on_config_changed('test') assert not hook.called
def test_load_component(monkeypatch): monkeypatch.setattr(objects, 'commands', {}) info = loader.ExtensionInfo(name='qutebrowser.components.scrollcommands') mod = loader._load_component(info, skip_hooks=True) assert hasattr(mod, 'scroll_to_perc') assert 'scroll-to-perc' in objects.commands
def test_init_hook(hook, module): module.info.init_hook = hook info = loader.ExtensionInfo(name='testmodule') loader._load_component(info) assert hook.called