def fire(self, name, *args, **kwargs): ''' Fire an arbitrary event Event names, by convention, should be lower-case-and-hypen-seperated. When events are hooked, the command that emitted the event will have its name prepended in this way. For example, before the InitCommand executes it will fire an event that can be handled by the name 'init-pre-exec' for an event fired with the name 'pre-exec'. ''' event.fire(self.command + '-' + name, *args, **kwargs)
def fire(self, eventname, *args, **kwargs): event.fire(self.name + '-' + eventname, *args, **kwargs)
def test_event_fire(): global CALLED CALLED = False event.fire('test-cb') assert CALLED == True