예제 #1
0
    def test_custom_hook_names(self):
        "Make sure that plugins with unknown hook names get discarded"
        class Plugin(PluginInterface):
            def get_name(self):
                return "Test plugin"
            def custom_hook(self):
                pass

        hooks.add_custom_hook("custom_hook")
        self.addCleanup(hooks.remove_custom_hook, "custom_hook")
        plugin = Plugin()
        plugins.manager.install(plugin, activate=True)
        self.addCleanup(plugins.manager.uninstall, plugin)
예제 #2
0
    def test_custom_hook_names(self):
        "Make sure that plugins with unknown hook names get discarded"

        class Plugin(PluginInterface):
            def get_name(self):
                return "Test plugin"

            def custom_hook(self):
                pass

        hooks.add_custom_hook("custom_hook")
        self.addCleanup(hooks.remove_custom_hook, "custom_hook")
        plugin = Plugin()
        plugins.manager.install(plugin, activate=True)
        self.addCleanup(plugins.manager.uninstall, plugin)
예제 #3
0
def test_custom_hook_names(request):
    "Make sure that plugins with unknown hook names get discarded"

    class Plugin(PluginInterface):
        def get_name(self):
            return "Test plugin"

        def custom_hook(self):
            pass

    hooks.add_custom_hook("custom_hook")

    @request.addfinalizer
    def cleanup():  # pylint: disable=unused-variable
        hooks.remove_custom_hook("custom_hook")

    plugin = Plugin()
    plugins.manager.install(plugin, activate=True)
    plugins.manager.uninstall(plugin)
예제 #4
0
 def setUp(self):
     super(CustomHooksTest, self).setUp()
     self.hook_name = "some_custom_hook"
     self.hook = hooks.add_custom_hook(self.hook_name)
예제 #5
0
 def test_cannot_install_default_hooks(self):
     with self.assertRaises(exceptions.HookAlreadyExists):
         hooks.add_custom_hook("test_start")
예제 #6
0
 def test_cannot_reinstall_hook_twice(self):
     with self.assertRaises(exceptions.HookAlreadyExists):
         hooks.add_custom_hook(self.hook_name)
예제 #7
0
파일: test_hooks.py 프로젝트: roeiba/slash
 def setUp(self):
     super(CustomHooksTest, self).setUp()
     self.hook_name = "some_custom_hook"
     self.hook = hooks.add_custom_hook(self.hook_name)
예제 #8
0
파일: test_hooks.py 프로젝트: roeiba/slash
 def test_cannot_install_default_hooks(self):
     with self.assertRaises(exceptions.HookAlreadyExists):
         hooks.add_custom_hook("test_start")
예제 #9
0
파일: test_hooks.py 프로젝트: roeiba/slash
 def test_cannot_reinstall_hook_twice(self):
     with self.assertRaises(exceptions.HookAlreadyExists):
         hooks.add_custom_hook(self.hook_name)