def run_suite(suite, testclass=None):
 if verbose:
  runner = unittest.TextTestRunner(sys.stdout, verbosity=2)
 else:
  runner = BasicTestRunner()
 result = runner.run(suite)
 if (not result.wasSuccessful()):
  if ((len(result.errors) == 1) and (not result.failures)):
   err = result.errors[0][1]
  elif ((len(result.failures) == 1) and (not result.errors)):
   err = result.failures[0][1]
  else:
   if (testclass is None):
    msg = 'errors occurred; run in verbose mode for details'
   else:
    msg = ('errors occurred in %s.%s' % (testclass.__module__, testclass.__name__))
   raise TestFailed(msg)
  raise TestFailed(err)

def run_suite ( suite , testclass = None ) : if verbose : runner = unittest . TextTestRunner ( sys . stdout , verbosity = 2 ) else : runner = BasicTestRunner ( ) result = runner . run ( suite ) if ( not result . wasSuccessful ( ) ) : if ( ( len ( result . errors ) == 1 ) and ( not result . failures ) ) : err = result . errors [ 0 ] [ 1 ] elif ( ( len ( result . failures ) == 1 ) and ( not result . errors ) ) : err = result . failures [ 0 ] [ 1 ] else : if ( testclass is None ) : msg = 'errors occurred; run in verbose mode for details' else : msg = ( 'errors occurred in %s.%s' % ( testclass . __module__ , testclass . __name__ ) ) raise TestFailed ( msg ) raise TestFailed ( err )
run tests from a unittest .