MCPcopy Create free account
hub / github.com/ipython/ipython / parse_test_output

Function parse_test_output

IPython/testing/tools.py:83–122  ·  view source on GitHub ↗

Parse the output of a test run and return errors, failures. Parameters ---------- txt : str Text output of a test run, assumed to contain a line of one of the following forms:: 'FAILED (errors=1)' 'FAILED (failures=1)' 'FAILED (errors=1, failures=1)'

(txt)

Source from the content-addressed store, hash-verified

81
82
83def parse_test_output(txt):
84 """Parse the output of a test run and return errors, failures.
85
86 Parameters
87 ----------
88 txt : str
89 Text output of a test run, assumed to contain a line of one of the
90 following forms::
91
92 'FAILED (errors=1)'
93 'FAILED (failures=1)'
94 'FAILED (errors=1, failures=1)'
95
96 Returns
97 -------
98 nerr, nfail
99 number of errors and failures.
100 """
101
102 err_m = re.search(r'^FAILED \(errors=(\d+)\)', txt, re.MULTILINE)
103 if err_m:
104 nerr = int(err_m.group(1))
105 nfail = 0
106 return nerr, nfail
107
108 fail_m = re.search(r'^FAILED \(failures=(\d+)\)', txt, re.MULTILINE)
109 if fail_m:
110 nerr = 0
111 nfail = int(fail_m.group(1))
112 return nerr, nfail
113
114 both_m = re.search(r'^FAILED \(errors=(\d+), failures=(\d+)\)', txt,
115 re.MULTILINE)
116 if both_m:
117 nerr = int(both_m.group(1))
118 nfail = int(both_m.group(2))
119 return nerr, nfail
120
121 # If the input didn't match any of these forms, assume no error/failures
122 return 0, 0
123
124
125# So nose doesn't think this is a test

Callers

nothing calls this directly

Calls 2

groupMethod · 0.80
searchMethod · 0.45

Tested by

no test coverage detected