def test_ensure_custom_hook_does_not_allow_built_in_hooks(self): with self.assertRaises(exceptions.HookAlreadyExists): hooks.ensure_custom_hook("test_start")
def test_ensure_custom_hook(self): self.assertIs(hooks.ensure_custom_hook(self.hook_name), self.hook) new_hook = hooks.ensure_custom_hook("new_custom_hook") self.addCleanup(hooks.remove_custom_hook, "new_custom_hook") self.assertIs(new_hook, hooks.new_custom_hook)