eric7/Unittest/Interfaces/UnittestExecutor.py

branch
unittest
changeset 9065
39405e6eba20
parent 9064
339bb8c8007d
equal deleted inserted replaced
9064:339bb8c8007d 9065:39405e6eba20
172 (data["id"], data["name"], data["description"]) 172 (data["id"], data["name"], data["description"])
173 ) 173 )
174 174
175 # test result 175 # test result
176 elif data["event"] == "result": 176 elif data["event"] == "result":
177 fn, ln = None, None 177 filename, lineno = None, None
178 tracebackLines = [] 178 tracebackLines = []
179 if "traceback" in data: 179 if "traceback" in data:
180 # get the error info 180 # get the error info
181 tracebackLines = data["traceback"].splitlines() 181 tracebackLines = data["traceback"].splitlines()
182 # find the last entry matching the pattern 182 # find the last entry matching the pattern
184 fmatch = re.search(r'File "(.*?)", line (\d*?),.*', 184 fmatch = re.search(r'File "(.*?)", line (\d*?),.*',
185 tracebackLines[index]) 185 tracebackLines[index])
186 if fmatch: 186 if fmatch:
187 break 187 break
188 if fmatch: 188 if fmatch:
189 fn, ln = fmatch.group(1, 2) 189 filename = fmatch.group(1)
190 lineno = int(fmatch.group(2))
190 191
191 if "shortmsg" in data: 192 if "shortmsg" in data:
192 message = data["shortmsg"] 193 message = data["shortmsg"]
193 elif tracebackLines: 194 elif tracebackLines:
194 message = tracebackLines[-1].split(":", 1)[1].strip() 195 message = tracebackLines[-1].split(":", 1)[1].strip()
204 message=message, 205 message=message,
205 extra=tracebackLines, 206 extra=tracebackLines,
206 duration=( 207 duration=(
207 data["duration_ms"] if "duration_ms" in data else None 208 data["duration_ms"] if "duration_ms" in data else None
208 ), 209 ),
209 filename=fn, 210 filename=filename,
210 lineno=ln, 211 lineno=lineno,
211 subtestResult=data["subtest"] if "subtest" in data else False 212 subtestResult=data["subtest"] if "subtest" in data else False
212 )) 213 ))
213 214
214 # test run finished 215 # test run finished
215 elif data["event"] == "finished": 216 elif data["event"] == "finished":

eric ide

mercurial