def parse_test_output(txt):
 err_m = re.search('^FAILED \\(errors=(\\d+)\\)', txt, re.MULTILINE)
 if err_m:
  nerr = int(err_m.group(1))
  nfail = 0
  return (nerr, nfail)
 fail_m = re.search('^FAILED \\(failures=(\\d+)\\)', txt, re.MULTILINE)
 if fail_m:
  nerr = 0
  nfail = int(fail_m.group(1))
  return (nerr, nfail)
 both_m = re.search('^FAILED \\(errors=(\\d+), failures=(\\d+)\\)', txt, re.MULTILINE)
 if both_m:
  nerr = int(both_m.group(1))
  nfail = int(both_m.group(2))
  return (nerr, nfail)
 return (0, 0)

def parse_test_output ( txt ) : err_m = re . search ( '^FAILED \\(errors=(\\d+)\\)' , txt , re . MULTILINE ) if err_m : nerr = int ( err_m . group ( 1 ) ) nfail = 0 return ( nerr , nfail ) fail_m = re . search ( '^FAILED \\(failures=(\\d+)\\)' , txt , re . MULTILINE ) if fail_m : nerr = 0 nfail = int ( fail_m . group ( 1 ) ) return ( nerr , nfail ) both_m = re . search ( '^FAILED \\(errors=(\\d+), failures=(\\d+)\\)' , txt , re . MULTILINE ) if both_m : nerr = int ( both_m . group ( 1 ) ) nfail = int ( both_m . group ( 2 ) ) return ( nerr , nfail ) return ( 0 , 0 )
parse the output of a test run and return errors .