def run_example(example, reporter=None):
 if reporter:
  reporter.write(example)
 else:
  print(('=' * 79))
  print('Running: ', example)
 try:
  mod = load_example_module(example)
  if reporter:
   suppress_output(mod.main)
   reporter.write('[PASS]', 'Green', align='right')
  else:
   mod.main()
  return True
 except KeyboardInterrupt as e:
  raise e
 except:
  if reporter:
   reporter.write('[FAIL]', 'Red', align='right')
  traceback.print_exc()
  return False

def run_example ( example , reporter = None ) : if reporter : reporter . write ( example ) else : print ( ( '=' * 79 ) ) print ( 'Running: ' , example ) try : mod = load_example_module ( example ) if reporter : suppress_output ( mod . main ) reporter . write ( '[PASS]' , 'Green' , align = 'right' ) else : mod . main ( ) return True except KeyboardInterrupt as e : raise e except : if reporter : reporter . write ( '[FAIL]' , 'Red' , align = 'right' ) traceback . print_exc ( ) return False
run a specific example .