def test_inherit_policy_changing_parent(): gossip.define("group.hook") group = gossip.get_group("group") for policy in (gossip.RaiseImmediately(), gossip.RaiseDefer(), gossip.IgnoreExceptions()): gossip.set_exception_policy(policy) assert group.get_exception_policy() is policy
doc="Called whenever an exception is caught, but a debugger hasn't been entered yet") _define('entering_debugger', doc='Called right before entering debugger', arg_names=('exc_info',)) _define('exception_caught_after_debugger', doc="Called whenever an exception is caught, and a debugger has already been run") _define('before_worker_start', doc="Called in parallel execution mode, before the parent starts the child worker", arg_names=("worker_config",)) _define('prepare_notification', doc='Called with a message object prior to it being sent via the notifications plugin (if enabled)', arg_names=("message",)) _define('before_interactive_shell', doc='Called before starting interactive shell', arg_names=("namespace",)) _slash_group = gossip.get_group('slash') _slash_group.set_strict() _slash_group.set_exception_policy(gossip.RaiseDefer()) @gossip.register('gossip.on_handler_exception') # pylint: disable=unused-argument def debugger(handler, exception, hook): # pylint: disable=unused-argument from .exception_handling import handle_exception if hook.group is _slash_group and config.root.debug.debug_hook_handlers: handle_exception(exception) @_deprecated_to_gossip def add_custom_hook(hook_name): """ Adds an additional hook to the set of available hooks """ return _define(hook_name)