Exemple #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)
Exemple #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)
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)
Exemple #4
0
 def setUp(self):
     super(CustomHooksTest, self).setUp()
     self.hook_name = "some_custom_hook"
     self.hook = hooks.add_custom_hook(self.hook_name)
Exemple #5
0
 def test_cannot_install_default_hooks(self):
     with self.assertRaises(exceptions.HookAlreadyExists):
         hooks.add_custom_hook("test_start")
Exemple #6
0
 def test_cannot_reinstall_hook_twice(self):
     with self.assertRaises(exceptions.HookAlreadyExists):
         hooks.add_custom_hook(self.hook_name)
Exemple #7
0
 def setUp(self):
     super(CustomHooksTest, self).setUp()
     self.hook_name = "some_custom_hook"
     self.hook = hooks.add_custom_hook(self.hook_name)
Exemple #8
0
 def test_cannot_install_default_hooks(self):
     with self.assertRaises(exceptions.HookAlreadyExists):
         hooks.add_custom_hook("test_start")
Exemple #9
0
 def test_cannot_reinstall_hook_twice(self):
     with self.assertRaises(exceptions.HookAlreadyExists):
         hooks.add_custom_hook(self.hook_name)