def test_builtin_vs_plugin_hooks(): hooks.register_builtin("bla", lambda: True) assert hooks.registered("bla") == True hooks.register_from_plugin("blub", lambda: True) assert hooks.registered("blub") == True hooks.load_plugins(force=True) assert hooks.registered("bla") == True assert hooks.registered("blub") == False
def test_hook_registration(): assert hooks.hooks == {} # pre 1.6 API hooks.register("bla", lambda: True) assert hooks.get("bla")[0].is_builtin == False hooks.register_builtin("blub", lambda: True) hooks.register_from_plugin("blub", lambda: False) assert hooks.get("blub")[0].is_builtin == True assert hooks.get("blub")[1].is_builtin == False assert hooks.registered("bla") == True assert hooks.registered("blub") == True assert hooks.registered("bli") == False assert len(hooks.get("bla")) == 1 assert len(hooks.get("blub")) == 2 assert len(hooks.get("bli")) == 0