def register_hooks(self): for attr in dir(self): attr = getattr(self, attr) eventname = getattr(attr, 'handled_event', None) if eventname: event.register(eventname, attr)
def test_event_register(): event.register('test-cb', _callback) callbacks = event.get_events() assert 'test-cb' in callbacks assert _callback in callbacks['test-cb']