예제 #1
0
def run(testSource):
  """
  run(testSource: str) -> None

  given the path of a python package containing Bronto tests,
  run all those tests and print output to the console.
  """

  testCases = getTestCases(testSource)

  print 'Bronto running', len(testCases), 'tests:'
  print '=' * 80
  
  before = time.clock()
  successes = 0
  failures = []

  idx = 0
  for idx in range(len(testCases)):
    testCase = testCases[idx]
    try:
      runTestCase(testCase)
      put_colored('+ ', color='green')
      successes += 1

    except Exception, err:
      put_colored('* ', color='red')
      failures.append(err)

    if idx % 40 == 39:
      put_colored('\n')
예제 #2
0
  idx = 0
  for idx in range(len(testCases)):
    testCase = testCases[idx]
    try:
      runTestCase(testCase)
      put_colored('+ ', color='green')
      successes += 1

    except Exception, err:
      put_colored('* ', color='red')
      failures.append(err)

    if idx % 40 == 39:
      put_colored('\n')

  put_colored('\n')

  timeDelta = time.clock() - before

  print successes, 'tests passed and', len(failures),\
      'failed (in', timeDelta, 'seconds)'
  print '=' * 80

  for fail in failures:
    printError(fail)

def printError(err):
  """
  printError(err: Exception) -> None

  prints an exception in red