@contextmanager
def capture_registrations():
 registrations = []
 def _on(app, **data):
  registrations.append(data)
 user_registered.connect(_on)
 try:
  (yield registrations)
 finally:
  user_registered.disconnect(_on)

@ contextmanager def capture_registrations ( ) : registrations = [ ] def _on ( app , ** data ) : registrations . append ( data ) user_registered . connect ( _on ) try : ( yield registrations ) finally : user_registered . disconnect ( _on )
testing utility for capturing registrations .